|
-
Apr 2nd, 2004, 10:14 AM
#8
PowerPoster
Hi,
I did not deal with your main query as I just rushed back from a tennis match and only took a cursory look at the forum before lunch.
First of all, I personally would not use both a Dataset and a DataTable. I would fill the DataTable directly from the Data Adapter.
VB Code:
myDataAdapter.Fill(myTable, "Employees")
With regard to your problem, you cannot reference a value of -1
as
cmbSurname.SelectedIndex
The value -1 is returned when you try to reference an item in a ComboBox with no item selected.
If you want to go to the first entry in the ComboBox use
VB Code:
cmbSurname.SelectedIndex = 0
If you want to view the ValueMember of the Selected item, try
(I edited out this bit as your existing code should now work, once you abandon the -1 bit. You simply use the combo to select an item)
I am a beginner and I have only checked the foregoing once, so forgive me if it needs amending.
Last edited by taxes; Apr 2nd, 2004 at 10:56 AM.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|