You are currently viewing the BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .

I have a question about this exercise. In the exercise you have to create a boolean variable and set the default value to True. As you continue, once you bind the data to the combo box, you set the value of the boolean variable to False. Why is it that when I go to the SelectedValueChanged event of my comboBox, the code will not work unless I have some kind of If statement on top? It shouldn't whether I have that variable or not, the code should still work. I'm I missing something about the SelectedValueChanged event that I should be aware of?

When you bind the combobox, the SelectedValueChange event is fired. If you do not have the If statement as the first code in your ComboBox1_SelectedValueChanged procedure, the rest of the code will be executed and an execption will be thrown because no data will have been loaded at this point. Try commenting out the If statement at the top of this procedure to see what I talking about.

Yes, I saw that before, but I just don't seem to understand why the data wont load unless I have the "IF" stament there, when I have told the data to bind to the combo box in my previous Sub procedure.

Hi all, I have coded exercise 2 exactly but when I populate the ComboBox I get this error message:
"Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)."
on this line of code:
[
'Add the required parameter for the queryobjCommand.Parameters.Add("@ProjectID", OleDbType.Guid, 16).Value = _New Guid(cb1.SelectedValue.ToString)]