Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 2nd, 2006, 03:25 PM
Registered User
 
Join Date: Dec 2005
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?

 
Old November 6th, 2006, 07:04 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
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
 
Old November 7th, 2006, 11:28 AM
Registered User
 
Join Date: Dec 2005
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.

 
Old November 8th, 2006, 05:59 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

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

Thearon
 
Old February 1st, 2011, 03: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





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 02:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.