Skip Navigation Links
Home
Forum Home
Latest 50
Unanswered
Win Prizes
All Time Leaders
Jump to CategoryExpand Jump to Category
Login 
    Welcome Guest!
 Search Forum For :  
X
 Login
Please login to submit a new post, reply and edit exiting posts, see user profiles, and access more features. If you are not a registered member, Register here.
User Id / Email:
Password:  
Forgot Password | Forgot UserName
   Home » Windows Azure » Combobox logic
       
Author Reply
Darnell Dudley
posted 591 posts
since Feb 20, 2010 
from

Combobox logic

  Posted on: 07 Feb 2012       
I have Combobox A, and Combobox B. Both combox A and B are related to each other.

Combobox A : Color serial No

Combobox B : Color part No

Note:  Color serial No, and Color part No belongs to a color type.

if user select an item in combo box A, combo box B will populate exists Color part No that are related to Color serial No. from the dataset or database.

or

if user select an item in combo box B combo box A will populate exists Color serial No that are related to Color part No.
from the dataset or database.

I am basically limiting the user to only query the items that only exist relate to each other by color serial and part no.

Can someone give me an ideal to effectively design this logic. At the moment.



Satyapriya Nayak
posted  1902 posts
since  Mar 24, 2010 
from 

 Re: Combobox logic
  Posted on: 07 Feb 2012        0  
Hi Darnell,

Try this...

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace Comboboxs
{
    public partial class Form1 : Form
    {
        string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["dsn"];
        OleDbCommand com;
        OleDbDataAdapter oda;
        DataSet ds;
        string str;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            comboBox1.Items.Add("Choose Color serial No");
            OleDbConnection con = new OleDbConnection(ConnectionString);
            con.Open();
            str = "select * from Color";
            com = new OleDbCommand(str, con);
            OleDbDataReader reader = com.ExecuteReader();
            while (reader.Read())
            {
                comboBox1.Items.Add(reader["ColorserialNo"]);
            }
          
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBox2.Items.Clear();
            OleDbConnection con = new OleDbConnection(ConnectionString);
            con.Open();
            str = "select * from Color where ColorserialNo='" + comboBox1.Text.Trim() + "'";
            com = new OleDbCommand(str, con);
            OleDbDataReader reader = com.ExecuteReader();
            while (reader.Read())
            {
                comboBox2.Items.Add(reader["ColorpartNo"].ToString());
            }
            con.Close();
            reader.Close();
        }
    }
}



Thanks
Darnell Dudley
posted  591 posts
since  Feb 20, 2010 
from 

 Re: Combobox logic
  Posted on: 07 Feb 2012        0  
The query is not the problem, I am using a tableadapter from the designer that has a stored procedure. And everytime i call the tableadapter it takes long, its only three records in the database, so it should not be taking 15 seconds, this is my first time using mysql, i am normally using SQL Server 2008.


Keep in mind there is two combo boxes, and they are both related to each other, so they can select any item from either combo box. So if i to reload the combo box base upon the item select in the combo box, the minute i select an item in combo box a , I have to reload the combo box B with the related records, vi versa etc.........


can you also tell which is the quicker way for the data to return faster then what its doing, I am using linq to pull from from the database.
I am using similiar below, and its slow, the database only have three records at the moment. Any suggestions.

example:

IF ComboBox A is selected first then do this below
{

var List = from l in colorTableAdapter.GetData
              where l.ColorSerialNumber == ComboBoxA.Text
              select l,



ComboBoxB.Datasource = List.Select( t => t.ColorPartNo).ToList();

}

ELSE
{


var List = from l in colorTableAdapter.GetData
              where l.ColorPartNumber == ComboBoxB.Text
              select l,



ComboBoxA.Datasource = List.Select( t => t.ColorSerialNo).ToList();



}


       
Top Articles
View all »
Nevron Gauge for SharePoint
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!

 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Advertise with us
Current Version: 5.2011.3.12
 © 1999 - 2012  Mindcracker LLC. All Rights Reserved