By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

how to refresh the form

P: n/a
(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

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>42jOgrcuxE6pG3AVbxg2RA==</Id>
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
what control needs to refresh? have you already bound it to the
datasource?

Nov 21 '05 #2

P: n/a
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
Nov 21 '05 #3

P: n/a
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.

--
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com
"venkat g via .NET 247" wrote:
(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

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>42jOgrcuxE6pG3AVbxg2RA==</Id>

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.