how to refresh the form

  • Thread starter Thread starter venkat g via .NET 247
  • Start date Start date
V

venkat g via .NET 247

(Type your message here)

--------------------------------
From: venkat g

as soon as i click save button in should save the data and form must be refresh
ihave written as
me.refresh

my coding is as follows

If (txtget.Text = "Add") Then
ObjCon.Open()
objAdapt = New OleDbDataAdapter("select * from DB_KEYINFO", ObjCon)
objAdapt.Fill(ds)
ObjDtview = ds.Tables(0).DefaultView
ObjDtview.RowFilter = " [Keyno] = '" & CInt(txtKeyno.Text) & " '"
If (ObjDtview.Count > 0) Then
MsgBox("The Record Is Alreday Exists")
Me.Refresh()
ObjCon.Close()
Else
'ObjCon.Open()
ObjCmd.Connection = ObjCon
ObjCmd.CommandType = CommandType.Text
ObjCmd.CommandText = "Insert into DB_KEYINFO Values( '" & txtname.Text & "'," & txtpsno.Text & ",'" & txtdepartment.Text & "','" & cmbfloor.SelectedItem.text & "'," & txtKeyno.Text & ")"
ObjCmd.ExecuteNonQuery()
MsgBox("Records Saved successfully")
ObjCon.Close()
End If
 
Venkat,

Your code is not changing anything on screen when you to the inster.
Therefore: "Why should it refresh after that you updated it?

In addition, why are you using consequently obj before every object. It adds
in my opinion nothing to your code, it makes it only less readable.

Cor
 
Do you by any chance mean that you want to clear the form? If so, you will
need to empty each of the text boxes you have in the form.
 
Back
Top