Problem in using combo box

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2007
Posts: 58
Reputation: guest11 is an unknown quantity at this point 
Solved Threads: 2
guest11 guest11 is offline Offline
Junior Poster in Training

Problem in using combo box

 
0
  #1
Jan 23rd, 2009
hi all,
I want to use combo box in my application and i want to give user only selection option for combo box when they are entry data so i make combo boxs style property to drop down list. But when he edit the data then i access that record from database and want to set combo boxs value to that combo box but when i am assigning value to that combo box then i am getting error saying combo boxs text property is read only. I don't want to give edit facility for combo box in my application.
so can anybody tell me how can i do that.?
Thanks in advance

Regards
Guest11
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Problem in using combo box

 
0
  #2
Jan 23rd, 2009
Hi,

Set ComboBox's Style = 2 -DropDown List

This will allow user to only select from the available List

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 58
Reputation: guest11 is an unknown quantity at this point 
Solved Threads: 2
guest11 guest11 is offline Offline
Junior Poster in Training

Re: Problem in using combo box

 
0
  #3
Jan 23rd, 2009
But i also want to assign value when user access data from database. Actually what i am doing is, when user enter new data that time i gave him selection from combo box but when user edit data that time that combo box's value will have to assign to that combo box. I make style property of combo box to drop down but when i assign value to it that time i am getting error as text box property is read only. I am not able to assign value to that combo box.

suppose i gave division selection in combo box.
But when user access that data from database and when i am trying to assign divisions value to that combo box i am getting error as text box property is read only.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 537
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: Problem in using combo box

 
0
  #4
Jan 23rd, 2009
first of all, your question is not clear at all...
you need to be more specific on what are you trying to accomplish...and please check your english....

okk....now for the coding purpose....you can use this code to add any customized value to a read-only combo box and assign the text of combo box to the newly added value...

with combo1
.AddItem text1.text
end with

combo1.text=Text1.text


keep in mind...you have to first add the new value to the combo box collection and then only you can assign it as current selection of value in the combo box...

there are also more alternative options...but try this one first....and get a feedback on what you got finally...

regards
Shouvik
Last edited by choudhuryshouvi; Jan 23rd, 2009 at 11:19 am.
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 509
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 88
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: Problem in using combo box

 
0
  #5
Jan 26th, 2009
Hi, ComboBox.Style is ReadOnly property at Runtime, that means you can change its value only design time.

Try another logic instead of using Style property.

Originally Posted by guest11 View Post
But i also want to assign value when user access data from database. Actually what i am doing is, when user enter new data that time i gave him selection from combo box but when user edit data that time that combo box's value will have to assign to that combo box. I make style property of combo box to drop down but when i assign value to it that time i am getting error as text box property is read only. I am not able to assign value to that combo box.

suppose i gave division selection in combo box.
But when user access that data from database and when i am trying to assign divisions value to that combo box i am getting error as text box property is read only.
KSG
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC