473,378 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

combobox on form load

Hi,
I have a combo box that I want to populate, based on the selection of
another combo box.

So when combo box A is selected, combo box B is populated with related values.

I have this all working fine, except for on the forms loading. I have
combobox B being populated after combobox A_SelectedIndexChanged event fires.

However, on the form load, when I try to retrieve the value from
"selectedvalue" , field, it is giving me "System.Data.DataRowView". that is
the field isnt populated.

I dont understand why there is no value if the selectedindex changed event
is firing?

Can someone advise how I should be handling this. Even when the combo box
isnt yet populated, the selected index is showing as zero?.

thanks
Aug 23 '06 #1
2 6462
Ausclad,

I have answered your question in another newsgroup.

Cor

"Ausclad" <Au*****@discussions.microsoft.comschreef in bericht
news:CA**********************************@microsof t.com...
Hi,
I have a combo box that I want to populate, based on the selection of
another combo box.

So when combo box A is selected, combo box B is populated with related
values.

I have this all working fine, except for on the forms loading. I have
combobox B being populated after combobox A_SelectedIndexChanged event
fires.

However, on the form load, when I try to retrieve the value from
"selectedvalue" , field, it is giving me "System.Data.DataRowView". that
is
the field isnt populated.

I dont understand why there is no value if the selectedindex changed event
is firing?

Can someone advise how I should be handling this. Even when the combo box
isnt yet populated, the selected index is showing as zero?.

thanks


Aug 23 '06 #2

Try the following code. take two comboboxes and use the following code.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("First")
ComboBox1.Items.Add("Second")
ComboBox1.Items.Add("Third")
ComboBox1.SelectedIndex = 0
End Sub

Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles ComboBox1.TextChanged
If ComboBox1.Text = "First" Then
ComboBox2.Items.Clear()
ComboBox2.Items.Add("a")
ComboBox2.Items.Add("b")
ComboBox2.Items.Add("c")
ComboBox2.SelectedIndex = 0
ElseIf ComboBox1.Text = "Second" Then
ComboBox2.Items.Clear()
ComboBox2.Items.Add("d")
ComboBox2.Items.Add("e")
ComboBox2.Items.Add("f")
ComboBox2.SelectedIndex = 0
ElseIf ComboBox1.Text = "Third" Then
ComboBox2.Items.Clear()
ComboBox2.Items.Add("g")
ComboBox2.Items.Add("h")
ComboBox2.Items.Add("i")
ComboBox2.SelectedIndex = 0
End If
End Sub

Aug 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: aaa | last post by:
Hello to all, In an application under VB6, I need to fill some ComboBoxes with data. However, I don't know in advance how many ComboBoxes I will need. I could of course create many (maybe 15 or...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
7
by: charliewest | last post by:
Using .Net CF, i have created a 2 dimension ArrayList, and "binded" this list to a ComboBox control using the "DataSource" property. I have set the DisplaySource and ValueMember properties as well....
4
by: Kalvin | last post by:
I have seen this question raised, but I cannot find an answer. I have an MDI app, when I load an child form with a combobox being bound in the load event, it won't allow me to set selectedindex =...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
4
by: Vish | last post by:
Hi, I am having a problem with my form being too slow to load up. I have a 4-5 of comboboxes on the form that load a lot (~30,000 records) into them. So this is causing a lot delay (5-6 seconds)...
6
by: tbrown | last post by:
I have a combobox with items like this: {one,two,three}. The selected index is 0, so "one" appears in the combobox text. When the user drops down the list, and selects "two", for example, I...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I have to load 30,000 unique names into a combox. Filling a dataTable takes only a few milliseconds. But populating the combobox and displaying the list takes several seconds - way...
3
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.