Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 Databases by Thearon Willis; ISBN: 9780764588945
Welcome to the p2p.wrox.com Forums.

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 .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 2nd, 2006, 02:25 PM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 5 Exercise 2

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?

Reply With Quote
  #2 (permalink)  
Old November 6th, 2006, 06:04 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Location: Fuquay Varina, NC, USA.
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

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.

Thearon
Reply With Quote
  #3 (permalink)  
Old November 7th, 2006, 10:28 AM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Reply With Quote
  #4 (permalink)  
Old November 8th, 2006, 04:59 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Location: Fuquay Varina, NC, USA.
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Because the SelectedValueChange event is being fired when you perform the binding.

Thearon
Reply With Quote
  #5 (permalink)  
Old February 1st, 2011, 02:24 PM
Registered User
 
Join Date: Feb 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 5 Ex 2

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 query
objCommand.Parameters.Add("@ProjectID", OleDbType.Guid, 16).Value = _
New Guid(cb1.SelectedValue.ToString)]

Anyone know what I'm doing wrong?

Thanks
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 3 - Exercise 3 AndyN BOOK: Beginning Cryptography with Java 3 August 16th, 2006 03:09 PM
Chapter 5 - Exercise 1 scgtman BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 3 May 16th, 2006 08:10 PM
Chapter 3 Exercise 3 Matt WAXON BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 July 4th, 2005 02:19 AM
Chapter 4, Exercise 3 DRAYKKO BOOK: Beginning Java 2 3 July 9th, 2004 02:34 PM
Chapter 8, Exercise 4 cjo BOOK: Beginning ASP.NET 1.0 0 November 3rd, 2003 01:26 PM



All times are GMT -4. The time now is 02:56 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.