Click here to Skip to main content
16,020,626 members
Home / Discussions / Windows Forms
   

Windows Forms

 
QuestionSQL query worked fine... until I tried it in Visual Studio 2008 Pin
Andrew Tamberino17-Jun-09 9:12
Andrew Tamberino17-Jun-09 9:12 
AnswerRe: SQL query worked fine... until I tried it in Visual Studio 2008 Pin
Dave Kreskowiak17-Jun-09 10:19
mveDave Kreskowiak17-Jun-09 10:19 
GeneralRe: SQL query worked fine... until I tried it in Visual Studio 2008 Pin
Andrew Tamberino17-Jun-09 11:07
Andrew Tamberino17-Jun-09 11:07 
GeneralRe: SQL query worked fine... until I tried it in Visual Studio 2008 Pin
Dave Kreskowiak17-Jun-09 13:33
mveDave Kreskowiak17-Jun-09 13:33 
GeneralRe: SQL query worked fine... until I tried it in Visual Studio 2008 Pin
Andrew Tamberino17-Jun-09 14:23
Andrew Tamberino17-Jun-09 14:23 
GeneralRe: SQL query worked fine... until I tried it in Visual Studio 2008 Pin
Dave Kreskowiak17-Jun-09 18:03
mveDave Kreskowiak17-Jun-09 18:03 
GeneralRe: SQL query worked fine... until I tried it in Visual Studio 2008 Pin
Andrew Tamberino18-Jun-09 9:54
Andrew Tamberino18-Jun-09 9:54 
Questionhow do i use textbox value from one form on another to access database without releasing the resource(value) Pin
ChiSmile17-Jun-09 7:35
ChiSmile17-Jun-09 7:35 
Hello there!
My code is highlighted below.I have five tabpages(two is shown here!) on a form called vwpatient that runs each time a tabpage is selected.The code below works but my problem is this: there is a textbox called sachPatient.patID from another form called sachPatient, the code pulls data from the database on clicking one or two pages, but if more than two is clicked, an exception fires saying "Make sure you have not released a resource before attempting to use it". I have tried endlessly to fix this problem to no avail. And am still trying!!.
I would appreciate if someone can help me.
Thanks in advance!!!




Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged


For Each tabcont As Control In Me.Controls
If TypeOf tabcont Is TabControl Then
For Each tp As Control In tabcont.Controls
If TypeOf tp Is TabPage Then
Select Case tp.Name
Case "vwProfTabPg"

Try

LoadData()
' Configure and execute the command.
cmd = New System.Data.SqlClient.SqlCommand("SELECT * FROM Patient_profile where patient_Id = @Pat_ID")
cmd.Connection = cn
Dim paraPatId As SqlParameter = cmd.Parameters.Add("@Pat_ID", sachPatient.patID.Text)
' Load the DataTable.
datadapt = New System.Data.SqlClient.SqlDataAdapter(cmd)
datadapt.Fill(ds)
ds.Tables.Add(dt)

' Bind the DataGrid.

vwProfDG.DataSource = ds.Tables(0)
vwProfDG.Visible = True

Catch ex As SqlException
MsgBox(ex.Message.ToString())
Finally
cn.Close()
End Try

Case "vwLabTabPg"
Try

LoadData()

' Configure and execute the command.
cmd = New System.Data.SqlClient.SqlCommand("SELECT * FROM lab where patient_Id = @PatLa_ID")
cmd.Connection = cn
Dim paraPatId As SqlParameter = cmd.Parameters.Add("@PatLa_ID", sachPatient.patID.Text)
' Load the DataTable.
datadapt = New System.Data.SqlClient.SqlDataAdapter(cmd)
datadapt.Fill(ds)
ds.Tables.Add(dt)

' Bind the DataGrid.

vwLabDatGrid.DataSource = ds.Tables(0)
vwLabDatGrid.Visible = True

Catch ex As SqlException
MsgBox(ex.Message.ToString())
Finally
cn.Close()
End Try
End Select
End If
Next
End If
Next
QuestionPropertyGrid control slow to load because it automatically "reflects" on all controls in current application ? Pin
BillWoodruff17-Jun-09 3:00
professionalBillWoodruff17-Jun-09 3:00 
AnswerRe: PropertyGrid control slow to load because it automatically "reflects" on all controls in current application ? Pin
led mike17-Jun-09 4:40
led mike17-Jun-09 4:40 
GeneralRe: PropertyGrid control slow to load because it automatically "reflects" on all controls in current application ? Pin
BillWoodruff17-Jun-09 5:07
professionalBillWoodruff17-Jun-09 5:07 
GeneralRe: PropertyGrid control slow to load because it automatically "reflects" on all controls in current application ? Pin
led mike17-Jun-09 5:48
led mike17-Jun-09 5:48 
GeneralRe: PropertyGrid control slow to load because it automatically "reflects" on all controls in current application ? Pin
BillWoodruff17-Jun-09 6:02
professionalBillWoodruff17-Jun-09 6:02 
GeneralRe: PropertyGrid control slow to load because it automatically "reflects" on all controls in current application ? Pin
DaveyM6917-Jun-09 6:11
professionalDaveyM6917-Jun-09 6:11 
GeneralRe: PropertyGrid control slow to load because it automatically "reflects" on all controls in current application ? Pin
led mike17-Jun-09 6:20
led mike17-Jun-09 6:20 
Generalto Led Mike and DaveyM69 : Re: PropertyGrid control slow to load because it automatically "reflects" on all controls in current application ? Pin
BillWoodruff17-Jun-09 11:06
professionalBillWoodruff17-Jun-09 11:06 
GeneralRe: to Led Mike and DaveyM69 : Re: PropertyGrid control slow to load because it automatically "reflects" on all controls in current application ? Pin
Scott Dorman17-Jun-09 12:57
professionalScott Dorman17-Jun-09 12:57 
GeneralRe: to Led Mike and DaveyM69 : Re: PropertyGrid control slow to load because it automatically "reflects" on all controls in current application ? Pin
BillWoodruff17-Jun-09 19:54
professionalBillWoodruff17-Jun-09 19:54 
QuestionHow to hook up a VScrollBar to a control? Pin
Alan Burkhart16-Jun-09 19:00
Alan Burkhart16-Jun-09 19:00 
AnswerRe: How to hook up a VScrollBar to a control? Pin
Eslam Afifi17-Jun-09 1:03
Eslam Afifi17-Jun-09 1:03 
Questionget Operating System name using c# Pin
myms.net15-Jun-09 21:17
myms.net15-Jun-09 21:17 
AnswerRe: get Operating System name using c# Pin
Luc Pattyn15-Jun-09 23:06
sitebuilderLuc Pattyn15-Jun-09 23:06 
AnswerRe: get Operating System name using c# Pin
dan!sh 17-Jun-09 2:56
professional dan!sh 17-Jun-09 2:56 
AnswerRe: get Operating System name using c# Pin
DaveyM6917-Jun-09 5:26
professionalDaveyM6917-Jun-09 5:26 
GeneralRe: get Operating System name using c# Pin
dan!sh 18-Jun-09 6:04
professional dan!sh 18-Jun-09 6:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.