Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Easiest way to hide a VB form?

  • 04-12-2007 04:55PM
    #1
    Closed Accounts Posts: 5,240 ✭✭✭


    Looking for a quick simple solution to hide a form. I am swapping between two forms but they are just being generated on top of each other. The .hide method does not seem to work with forms.

    Cheers


Comments

  • Registered Users, Registered Users 2 Posts: 12,025 ✭✭✭✭Giblet


    setVisible false


  • Closed Accounts Posts: 5,240 ✭✭✭Endurance Man


    Ahh, i don't see setVisible anywhere? Would it be: form1.setVisible(false)?


  • Registered Users, Registered Users 2 Posts: 12,025 ✭✭✭✭Giblet


    Sorry, form1.Visible = false;


  • Closed Accounts Posts: 5,240 ✭✭✭Endurance Man


    Cheers giblet, that worked.

    Maybe you can give me a hand with my next problem :o.
    I have a form setup with 4 text boxes (txtName,txtEmail,txtExam,txtPercent). I have then connected to a very simple database which has a table which has properties for each of my text boxes. I have bound each text box to its appropriate property in the database as well. I then have a save button, when i click this i want the data i have entered to be saved to the dataset and then applied to the database.
    Im just not sure of the code behind my save button :(.

    Also im guessing the save function should be enclosed in a try/catch block?

    Any help much appreciated.


  • Closed Accounts Posts: 5,240 ✭✭✭Endurance Man


    snip


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 12,025 ✭✭✭✭Giblet


    Are you using SQL?

    It would be an insert statement using the values of your textboxes.

    Insert into tablename values(txtName,txtEmail,txtExam,txtPercent);

    Or whatever you have.

    Unless you mean you have the database table mapped to an object?


  • Closed Accounts Posts: 5,240 ✭✭✭Endurance Man


    No, im just using a DataAdapter and DataSet to extract the data. I then have each text box bound to the appropriate property.
    I tried this with no luck:

    OleDbDataAdapter1.Fill(AllData1)
    BindingContext(AllData1, "tblStudents").AddNew()
    txtForename.DataBindings.Add("Text", AllData1, "tblStudents.studentForeName")
    AllData1.AcceptChanges()
    OleDbDataAdapter1.Update(AllData1.Tables("tblStudents"))

    I'm probably way off, the notes iv been given are so badly written, cant make out half of it :(.
    I'm very new to VB so sorry if this doesn't make any sense :o, more of a java man.


Advertisement