Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh Form Data

Status
Not open for further replies.

saintedmunds

Technical User
Apr 7, 2006
78
GB
Hi

I have a form with a tabcontrol which has a panel in each tab when I open the main form I add a form to the panel which works ok. but when i go to my next record on the main form I cant get the tabcontol form to reload/refresh the data.

I have tried this

Dim frm2 As New fContactNotes
frm2.GetNotes()

GetNotes is a sub which i use to get the data on the form in the panel which works ok on the formload.

any help would be great

Cheers
 
There's no way for us to help with your problem with so little information.

Can you post the code in the GetNotes sub?



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Sorry here you go

Public Class fContactNotes

Dim myDataSet As New DataSet


Sub GetNotes()
Dim objConn As New SqlConnection
objConn.ConnectionString = strConn

Dim objcmd As SqlCommand
Dim myAdapter As New SqlDataAdapter


'Open the Database
Try

objcmd = New SqlCommand("spContactNotes", objConn)
objcmd.CommandType = CommandType.StoredProcedure

'Add paramters here
Dim param As New SqlParameter("@ContactID", SqlDbType.Int)
param.Value = ContactID
objcmd.Parameters.Add(param)

myAdapter.SelectCommand = objcmd
myAdapter.SelectCommand.Connection = objConn
myAdapter.Fill(myDataSet, "tNotes")

cContactNotes.DataSource = myDataSet.Tables(0)


Catch ex As Exception
MsgBox(ex.Message)
End Try
objConn.Close()


End Sub

Private Sub fContactNotes_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
GetNotes()
End Sub
End Class
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top