943,865 Members | Top Members by Rank

Ad:
Jan 23rd, 2009
0

Problem in using combo box

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
guest11 is offline Offline
59 posts
since Nov 2007
Jan 23rd, 2009
0

Re: Problem in using combo box

Hi,

Set ComboBox's Style = 2 -DropDown List

This will allow user to only select from the available List

Regards
Veena
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Jan 23rd, 2009
0

Re: Problem in using combo box

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.
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
guest11 is offline Offline
59 posts
since Nov 2007
Jan 23rd, 2009
0

Re: Problem in using combo box

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.
Reputation Points: 30
Solved Threads: 49
Posting Pro
choudhuryshouvi is offline Offline
553 posts
since May 2007
Jan 26th, 2009
0

Re: Problem in using combo box

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.

Click to Expand / Collapse  Quote originally posted by guest11 ...
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.
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Strange problem
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: vb6 moving frameless form on screen





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC