Hi. I am using visual studio with visual basic.
I have create a combo box which data is from oracle.
I want to know how to check the value in combo box is choose before i proceed to save the record? Thank you.
The text property of the combo box returns the current value of the edit box according to MSDN documentation.
So, you must validate your data through code before saving it into your database. In other words, if the text in the edit box has been changed, your program must make sure that that data can actually be saved in that particular field of your oracle recordset.
You can do this in the change event of the combo control. This only works, if the style property is set to 0 or 1.
Private Sub Combo1_Change() ' Code to validate the new value End Sub
Otherwise, you'll have to write a function to check the data before saving it to the database.
Private Sub CheckData() ' End Sub
Thnx for your advice.
So if i want to check many combo box in the same form. how to write the coding?
If my coding is as below:
Private Sub CheckData() If cboxUser.Text = "" Then MsgBox("Please insert you username!") End If End Sub
Then how can i advoid it will saved to data if combo box is empty value?
You could do something like the following. This would prompt for good data. The
variable strAnswer will store the answer from the user. You might want to code
to validate the user's answer, though. This is just a general idea.
Private Sub CheckData() Dim strAnswer As String If Combo1.Text = vbNullString Then strAnswer = InputBox("Please, enter proper data", "Data Error", "0") If strAnswer = "0" Then Exit Sub Else SaveData strAnswer End If End If End Sub Private Sub SaveData(ByVal GoodData as String) End Sub
yeah.thnx for ur suggestion.
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
Private Sub btn_addline_Click(ByVal ...