|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to return value in ComboboxHow to return the value from the database My combobox Me.cboTypeAdres.Items.Add("Type Adres") Me.cboTypeAdres.Items.Add("Leverancier") Me.cboTypeAdres.Items.Add("Klant") the value in the database = 0 ; 1 or 2 How to return the text using the value index so that the view is the bounded text ? Many thanks in advance Marc If you don't have the ability to add the name to your Database table
then the best way to do it is set a variable equal to the combobox SelectedIndex and send that. Put something like this code in the click event of a btnSave: Dim iAdresType as Integer iAdresType = cboTypeAdres.SelectedIndex SelectedIndex is zero based so you can put the combobox items in order that they are on the database. You could also use a Select Case statement that looks at the cboTypeAdres.Text and sends the appropriate SelectedIndex. Hope that helps! trevisc Scotty wrote: Show quoteHide quote > Hi, I need some info > > How to return the value from the database > > > My combobox > Me.cboTypeAdres.Items.Add("Type Adres") > Me.cboTypeAdres.Items.Add("Leverancier") > Me.cboTypeAdres.Items.Add("Klant") > > > > the value in the database = 0 ; 1 or 2 > > How to return the text using the value index so that the view is the bounded > text ? > > > > Many thanks in advance > > Marc Hi trevish,
Thanks for your answer, My realy question also = how to bind directly to database, now i have a textbox bound Me.txtAdresType.DataBindings.Add("text", bsAdressen, "AdresType") If I select my combo, the update in the textbox is working fine but if i will save the data and the textbox hans't been selected the value return to the previous old value. How to fix? Or how to databind the combobox "cboTypeAdres" direcly best regards, Marc. Show quoteHide quote "trevisc" <trev***@gmail.com> schreef in bericht news:1158151433.155330.314030@i3g2000cwc.googlegroups.com... > If you don't have the ability to add the name to your Database table > then the best way to do it is set a variable equal to the combobox > SelectedIndex and send that. > > Put something like this code in the click event of a btnSave: > > Dim iAdresType as Integer > > iAdresType = cboTypeAdres.SelectedIndex > > SelectedIndex is zero based so you can put the combobox items in order > that they are on the database. > > You could also use a Select Case statement that looks at the > cboTypeAdres.Text and sends the appropriate SelectedIndex. > > Hope that helps! > > trevisc > > > > Scotty wrote: >> Hi, I need some info >> >> How to return the value from the database >> >> >> My combobox >> Me.cboTypeAdres.Items.Add("Type Adres") >> Me.cboTypeAdres.Items.Add("Leverancier") >> Me.cboTypeAdres.Items.Add("Klant") >> >> >> >> the value in the database = 0 ; 1 or 2 >> >> How to return the text using the value index so that the view is the >> bounded >> text ? >> >> >> >> Many thanks in advance >> >> Marc > hmm..can you just put
cboTypeAdres.Focus() in the click event of the Save button? still not sure if i'm understanding the problem but if by clicking in a box it somehow refreshes your combo box then either do cboTypeAdres.refresh or just set focus to the combobox before you run the save routine. Show quoteHide quote > If I select my combo, the update in the textbox is working fine but if i > will save the data and the textbox hans't been selected the value return to > the previous old value. > > > > > "trevisc" <trev***@gmail.com> schreef in bericht > news:1158151433.155330.314030@i3g2000cwc.googlegroups.com... > > If you don't have the ability to add the name to your Database table > > then the best way to do it is set a variable equal to the combobox > > SelectedIndex and send that. > > > > Put something like this code in the click event of a btnSave: > > > > Dim iAdresType as Integer > > > > iAdresType = cboTypeAdres.SelectedIndex > > > > SelectedIndex is zero based so you can put the combobox items in order > > that they are on the database. > > > > You could also use a Select Case statement that looks at the > > cboTypeAdres.Text and sends the appropriate SelectedIndex. > > > > Hope that helps! > > > > trevisc > > > > > > > > Scotty wrote: > >> Hi, I need some info > >> > >> How to return the value from the database > >> > >> > >> My combobox > >> Me.cboTypeAdres.Items.Add("Type Adres") > >> Me.cboTypeAdres.Items.Add("Leverancier") > >> Me.cboTypeAdres.Items.Add("Klant") > >> > >> > >> > >> the value in the database = 0 ; 1 or 2 > >> > >> How to return the text using the value index so that the view is the > >> bounded > >> text ? > >> > >> > >> > >> Many thanks in advance > >> > >> Marc > > both does not work
On cboTypeAdres_SelectedIndexChanged the index value goes into txtTypeAdress Only after i select manualy txtTypeAdress the update function will succeed Show quoteHide quote "trevisc" <trev***@gmail.com> schreef in bericht news:1158159851.088146.192350@m73g2000cwd.googlegroups.com... > hmm..can you just put > > cboTypeAdres.Focus() in the click event of the Save button? > > still not sure if i'm understanding the problem but if by clicking in a > box it somehow refreshes your combo box then either do > cboTypeAdres.refresh or just set focus to the combobox before you run > the save routine. > > > >> If I select my combo, the update in the textbox is working fine but if i >> will save the data and the textbox hans't been selected the value return >> to >> the previous old value. > >> >> >> >> >> "trevisc" <trev***@gmail.com> schreef in bericht >> news:1158151433.155330.314030@i3g2000cwc.googlegroups.com... >> > If you don't have the ability to add the name to your Database table >> > then the best way to do it is set a variable equal to the combobox >> > SelectedIndex and send that. >> > >> > Put something like this code in the click event of a btnSave: >> > >> > Dim iAdresType as Integer >> > >> > iAdresType = cboTypeAdres.SelectedIndex >> > >> > SelectedIndex is zero based so you can put the combobox items in order >> > that they are on the database. >> > >> > You could also use a Select Case statement that looks at the >> > cboTypeAdres.Text and sends the appropriate SelectedIndex. >> > >> > Hope that helps! >> > >> > trevisc >> > >> > >> > >> > Scotty wrote: >> >> Hi, I need some info >> >> >> >> How to return the value from the database >> >> >> >> >> >> My combobox >> >> Me.cboTypeAdres.Items.Add("Type Adres") >> >> Me.cboTypeAdres.Items.Add("Leverancier") >> >> Me.cboTypeAdres.Items.Add("Klant") >> >> >> >> >> >> >> >> the value in the database = 0 ; 1 or 2 >> >> >> >> How to return the text using the value index so that the view is the >> >> bounded >> >> text ? >> >> >> >> >> >> >> >> Many thanks in advance >> >> >> >> Marc >> > > what about txtTypeAdress.focus() before you save?
Scotty wrote: Show quoteHide quote > both does not work > On cboTypeAdres_SelectedIndexChanged the index value goes into > txtTypeAdress > > Only after i select manualy txtTypeAdress the update function will > succeed > > > > > > "trevisc" <trev***@gmail.com> schreef in bericht > news:1158159851.088146.192350@m73g2000cwd.googlegroups.com... > > hmm..can you just put > > > > cboTypeAdres.Focus() in the click event of the Save button? > > > > still not sure if i'm understanding the problem but if by clicking in a > > box it somehow refreshes your combo box then either do > > cboTypeAdres.refresh or just set focus to the combobox before you run > > the save routine. > > > > > > > >> If I select my combo, the update in the textbox is working fine but if i > >> will save the data and the textbox hans't been selected the value return > >> to > >> the previous old value. > > > >> > >> > >> > >> > >> "trevisc" <trev***@gmail.com> schreef in bericht > >> news:1158151433.155330.314030@i3g2000cwc.googlegroups.com... > >> > If you don't have the ability to add the name to your Database table > >> > then the best way to do it is set a variable equal to the combobox > >> > SelectedIndex and send that. > >> > > >> > Put something like this code in the click event of a btnSave: > >> > > >> > Dim iAdresType as Integer > >> > > >> > iAdresType = cboTypeAdres.SelectedIndex > >> > > >> > SelectedIndex is zero based so you can put the combobox items in order > >> > that they are on the database. > >> > > >> > You could also use a Select Case statement that looks at the > >> > cboTypeAdres.Text and sends the appropriate SelectedIndex. > >> > > >> > Hope that helps! > >> > > >> > trevisc > >> > > >> > > >> > > >> > Scotty wrote: > >> >> Hi, I need some info > >> >> > >> >> How to return the value from the database > >> >> > >> >> > >> >> My combobox > >> >> Me.cboTypeAdres.Items.Add("Type Adres") > >> >> Me.cboTypeAdres.Items.Add("Leverancier") > >> >> Me.cboTypeAdres.Items.Add("Klant") > >> >> > >> >> > >> >> > >> >> the value in the database = 0 ; 1 or 2 > >> >> > >> >> How to return the text using the value index so that the view is the > >> >> bounded > >> >> text ? > >> >> > >> >> > >> >> > >> >> Many thanks in advance > >> >> > >> >> Marc > >> > > > Hi, Ive found it, see code below
Many thx for your idea's By adding the refrech to txtAdresType Private Sub cboTypeAdres_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboTypeAdres.SelectedIndexChanged Me.txtAdresType.Text = CStr(Me.cboTypeAdres.SelectedIndex) Me.txtAdresType.Focus() Me.txtAdresType.Refresh() End Sub Marc. Show quoteHide quote "trevisc" <trev***@gmail.com> schreef in bericht news:1158165620.080373.5800@e3g2000cwe.googlegroups.com... > what about txtTypeAdress.focus() before you save? > > > Scotty wrote: >> both does not work >> On cboTypeAdres_SelectedIndexChanged the index value goes into >> txtTypeAdress >> >> Only after i select manualy txtTypeAdress the update function will >> succeed >> >> >> >> >> >> "trevisc" <trev***@gmail.com> schreef in bericht >> news:1158159851.088146.192350@m73g2000cwd.googlegroups.com... >> > hmm..can you just put >> > >> > cboTypeAdres.Focus() in the click event of the Save button? >> > >> > still not sure if i'm understanding the problem but if by clicking in a >> > box it somehow refreshes your combo box then either do >> > cboTypeAdres.refresh or just set focus to the combobox before you run >> > the save routine. >> > >> > >> > >> >> If I select my combo, the update in the textbox is working fine but if >> >> i >> >> will save the data and the textbox hans't been selected the value >> >> return >> >> to >> >> the previous old value. >> > >> >> >> >> >> >> >> >> >> >> "trevisc" <trev***@gmail.com> schreef in bericht >> >> news:1158151433.155330.314030@i3g2000cwc.googlegroups.com... >> >> > If you don't have the ability to add the name to your Database table >> >> > then the best way to do it is set a variable equal to the combobox >> >> > SelectedIndex and send that. >> >> > >> >> > Put something like this code in the click event of a btnSave: >> >> > >> >> > Dim iAdresType as Integer >> >> > >> >> > iAdresType = cboTypeAdres.SelectedIndex >> >> > >> >> > SelectedIndex is zero based so you can put the combobox items in >> >> > order >> >> > that they are on the database. >> >> > >> >> > You could also use a Select Case statement that looks at the >> >> > cboTypeAdres.Text and sends the appropriate SelectedIndex. >> >> > >> >> > Hope that helps! >> >> > >> >> > trevisc >> >> > >> >> > >> >> > >> >> > Scotty wrote: >> >> >> Hi, I need some info >> >> >> >> >> >> How to return the value from the database >> >> >> >> >> >> >> >> >> My combobox >> >> >> Me.cboTypeAdres.Items.Add("Type Adres") >> >> >> Me.cboTypeAdres.Items.Add("Leverancier") >> >> >> Me.cboTypeAdres.Items.Add("Klant") >> >> >> >> >> >> >> >> >> >> >> >> the value in the database = 0 ; 1 or 2 >> >> >> >> >> >> How to return the text using the value index so that the view is >> >> >> the >> >> >> bounded >> >> >> text ? >> >> >> >> >> >> >> >> >> >> >> >> Many thanks in advance >> >> >> >> >> >> Marc >> >> > >> > >
Print the RichTextBox
Help Clearing data in MaskEditBox Control dumb question IIF referencing both conditional parts regardless of condition? Parsing XML Help with memory/resource use Immediate window Compiled HTML helpfile does not work when application is installed Adding parameters to stored procedures Controls in IDE -vs- Running in an App |
|||||||||||||||||||||||