Problem updating values in combobox in vb.net

Posted by user225269 on Stack Overflow See other posts from Stack Overflow or by user225269
Published on 2010-03-17T07:37:17Z Indexed on 2010/03/17 7:41 UTC
Read the original article Hit count: 244

Filed under:
|

I have this code, but I have a problem. When I update but do not really made any changes to the value and press the update button, the data becomes null. And it will seem that I deleted the value.

I've taught of a solution, that is to add both combobox1.selectedtext and combobox1.selecteditem to the function. But it doesn't work.

combobox1.selecteditem is working when you try to alter the values when you update. But will save a null value when you don't alter the values using the combobox

combobox1.selectedtext will save the data into the database even without altering. But will not save the data if you try to alter it.

-And I incorporated both of them, but still only one is performing, and I think it is the one that I added first:

Dim shikai As New Updater





Try

    shikai.id = TextBox1.Text
    shikai.fname = TextBox2.Text
    shikai.mi = TextBox3.Text
    shikai.lname = TextBox4.Text

    shikai.ad = TextBox5.Text
    shikai.contact = TextBox9.Text

    shikai.year = ComboBox1.SelectedText
    shikai.section = ComboBox2.SelectedText
    shikai.gender = ComboBox3.SelectedText
    shikai.religion = ComboBox4.SelectedText

    shikai.year = ComboBox1.SelectedItem
    shikai.section = ComboBox2.SelectedItem
    shikai.gender = ComboBox3.SelectedItem
    shikai.religion = ComboBox4.SelectedItem


    shikai.bday = TextBox6.Text



    shikai.updates()
    MsgBox("Successfully updated!")

Please help, what would be a simple workaround to solve this problem?

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about mysql