Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 13th, 2007, 11:45 AM
Authorized User
 
Join Date: Jun 2007
Location: , , .
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default combobox validation

i am having a combobox . i need the user to select something before he can save or do any other operations.

i searched the net i didn't get good examples...

could anyone please help me out in this....
  #2 (permalink)  
Old June 14th, 2007, 01:23 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi

u just do the following in the save button click event

  if(combobox.text != "")
 {
   //code for saving informations
}
else
{
messagebox("Please select an item in combo");
}

  #3 (permalink)  
Old June 14th, 2007, 09:53 AM
Authorized User
 
Join Date: Jun 2007
Location: , , .
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default


thank you for your suggestion.

I am planning to keep my save button disables until the selections are made.

So i would like to know which event "SelectedValueChanged" or "TextChanged" would be appropriate for this...

"SelectedIndexChanged" is used to display the values in other combobox as per selection in the first....

thanks
AKSSMV




Quote:
quote:Originally posted by velan
 hi

u just do the following in the save button click event

if(combobox.text != "")
{
//code for saving informations
}
else
{
messagebox("Please select an item in combo");
}

  #4 (permalink)  
Old June 14th, 2007, 11:17 PM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

if u use any of the event, after u just click on the combobox the button will get enabled. so textchanged event will be better.

 u check in the save button itself before data get into the database



  #5 (permalink)  
Old June 28th, 2007, 04:07 PM
Authorized User
 
Join Date: Jun 2007
Location: , , .
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thanks

i found it ,it's better to do it in Validating event and check the selected item is null.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Standalone validation + web form validation morbo Struts 0 August 19th, 2008 04:02 AM
Validation using Validation Framework kalyangvd Struts 1 January 2nd, 2008 06:53 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
combobox Warbird General .NET 0 January 7th, 2005 12:26 PM



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


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