473,385 Members | 1,461 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ComboBox Problem

I have a Combobox that is filled from a dataset.

I want to let the user be able to edit the text in the Combobox and if he
enters a text that is not a equal to any of the items in the combobox, I
want to catch that event.

As it is right now, the text the user wrote is overwritten with the
selecteditem when he leaves the Combobox.

Please help/
Lars
Nov 20 '05 #1
2 1275
gb
I added a combobox and set it's DropDownStyle to DropDown and then populate it using a Datatable in my Dataset. Using DropDown as the DropDownStyle allows you to enter text and what I typed in did not get replaced when I tabbed out of the combobox. I then used the Leave event of the combobox to check to see if what is in the text portion is in the datatable. Below for example

Private Sub ComboBox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.Leav
If DataSet.Datatable.Select("ColumnName = '" + ComboBox1.Text + "'").Length = 0 The
'Item typed is not in datatabl
Els
'Item is in databl
End I
End Su

Hope this helps
Nov 20 '05 #2
okey! Yeah I did the same thing and it works.. my problem is that in the
place where it doesn't work it's because it's a DataGridComboBox and it
does, or does not other things that are affecting this. That Special Class
that is written to make it possible to add it in a datagrid doesn't keep the
written value, it takes the selected value and use CurrencyManager to put
back that on the row in the datagrid when leaving. The written value is all
gone then.

Don't really know what to do about this! Don't really understand that class

/Lars
"gb" <an*******@discussions.microsoft.com> skrev i meddelandet
news:AC**********************************@microsof t.com...
I added a combobox and set it's DropDownStyle to DropDown and then populate it using a Datatable in my Dataset. Using DropDown as the
DropDownStyle allows you to enter text and what I typed in did not get
replaced when I tabbed out of the combobox. I then used the Leave event of
the combobox to check to see if what is in the text portion is in the
datatable. Below for example:
Private Sub ComboBox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.Leave If DataSet.Datatable.Select("ColumnName = '" + ComboBox1.Text + "'").Length = 0 Then 'Item typed is not in datatable
Else
'Item is in datable
End If
End Sub
Hope this helps

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chandra | last post by:
Hello Sir, This is Chandra and Working as Software Engineer. I got a really weird problem with ComboBoxes. I have set the ComboBox DroppedDown Property to true. Now the actual problem is...
7
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
1
by: anonymous | last post by:
I've been trying to put a them, please help me out. Here's the major parts of my code: public Form1() { DataSet myDataSet = new DataSet("myDataSet"); DataTable testTable = new...
3
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
0
by: tupolev | last post by:
Hi, I already post this item but now I know whats wrong: I want to allow the user to edit the items in a combobox. The problem is that the textchange event works just one time (for the first...
4
by: Keith | last post by:
Hello - this started out as a minor annoyance - and now is starting to bother me more and more - I'm hoping someone can help me. I would like to have a combobox display - NOT initially be blank...
30
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
5
by: Peter M. | last post by:
I'm struggling with combobox databinding with something I consider a bug... I'm binding my combobox to an array of structs. The struct exposes two public properties, ID and Name, to be used as...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.