Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 October 1st, 2004, 03:42 AM
Registered User
 
Join Date: Oct 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Value in Combobox

Hello,

How can I refer to value in combobox. Which's property, I can use.

Please give me a sample.

Thanks
 
Old October 1st, 2004, 03:45 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

User the SelectedValue property

Regards
Ganesh
 
Old October 1st, 2004, 03:58 AM
Registered User
 
Join Date: Oct 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks

I try to use the SelectedValue but it's error like the follow massage.

[u]A first chance exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll

Additional information: Specified cast is not valid.
</u>

and

[u]A first chance exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll

Additional information: Cast from type 'DataRowView' to type 'Integer' is not valid.
</u>

If you know why, please tell me more

Thanks
 
Old October 1st, 2004, 04:06 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

can u send me the code which you have written. It seems you are assigning it to a wrong datatype. This is not the error when u read the SelectedValue Property

Regards
Ganesh
 
Old October 1st, 2004, 04:21 AM
Registered User
 
Join Date: Oct 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi;

I write this code in my UI in order to pass value to bussiness object.

        Me.oBirthDistrict.GetDistrictsByProvinceIdentity(M e.cboBirthProvince.SelectedValue)

Regards
pasert

 
Old October 1st, 2004, 04:53 AM
Registered User
 
Join Date: Oct 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am sorry, the reply bebore not complete

The first error occur from this code.

Me.oBirthDistrict.GetDistrictsByProvinceIdentity(M e.cboBirthProvince.SelectedValue)

The second error occur from this code.

Me.oBirthDistrict.GetDistrictsByProvinceIdentity(C Type(Me.cboBirthProvince.SelectedValue, Integer))

regards
prasert
 
Old October 1st, 2004, 05:02 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

what do u have as the values of the ListItems? are they strings or Integer strings?

Regards
Ganesh
 
Old October 1st, 2004, 05:13 AM
Registered User
 
Join Date: Oct 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

The Values of the ListItems are Integer

Regards
Prasert
 
Old October 1st, 2004, 05:17 AM
Registered User
 
Join Date: Oct 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

The Values of the ListItems(source value) are Integer but the displays(source display) in combobox are String.

Regards
Prasert


 
Old October 1st, 2004, 05:38 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

what does your GetDistrictsByProvinceIdentity method accept as a parameter? if it accepts an integer, you should cast the SelectedValue as integer before passing

Regards
Ganesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
combobox nagarajuballa Java GUI 0 August 13th, 2008 03:49 AM
Filling Combobox with value from other Combobox ayazhoda Access VBA 6 June 5th, 2007 04:58 AM
Combobox stepdev Excel VBA 1 May 22nd, 2006 02:50 PM
New to ComboBox adriant42 Excel VBA 3 August 23rd, 2004 12:32 PM
ComboBox: HELP! ;) ashley_y ADO.NET 1 December 29th, 2003 10:44 AM





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