chrisryhal
asked on
Pass Datagrid Value to a form
1) I am filling a datagrid with the following values:
ID Number Description Customer
2) I need the user to be able to doubleclick on the row of the datagrid, and it then open up a form, with text boxes, that the values are passed to for updating.
Any help?
ID Number Description Customer
2) I need the user to be able to doubleclick on the row of the datagrid, and it then open up a form, with text boxes, that the values are passed to for updating.
Any help?
1) Declare a public function with parameters in your form2.
2) When you double click on the row of record in the datagrid of your form1, you will need to call
form2 out. but before you call the form2 out, call out the public function with parameters from
form2 first and pass in whatever values you need from your form1. This way you will be able to
transfer your selected data from your form1s' datagrid to form2.
2) When you double click on the row of record in the datagrid of your form1, you will need to call
form2 out. but before you call the form2 out, call out the public function with parameters from
form2 first and pass in whatever values you need from your form1. This way you will be able to
transfer your selected data from your form1s' datagrid to form2.
ASKER
I have tried that before even posting on here with no success. Would you happen to have an example of how the code is laid out.
On the Double Click Event of the DataGrid write
Dim DR As DataRow
DR = DataTable1.Rows(DataGrid.C urrentRowI ndex)
Dim Frm as New YourForm
Frm.ShowData(DR)
Frm.Show
Now Your Form which Shows the Data will have a function called ShowData
Public Sub Showdata(ByVal Dr As DataRow)
TextBox1.Text = Dr(0)
TextBox2.Text = Dr(1)
End Sub
However this is not a very preferred method of doing things, For example Double Click event will be fired even if the user double clicks on an empty region of the Grid,
Why don't you allow the user to Edit the Data in place, in the Grid itself...
Dim DR As DataRow
DR = DataTable1.Rows(DataGrid.C
Dim Frm as New YourForm
Frm.ShowData(DR)
Frm.Show
Now Your Form which Shows the Data will have a function called ShowData
Public Sub Showdata(ByVal Dr As DataRow)
TextBox1.Text = Dr(0)
TextBox2.Text = Dr(1)
End Sub
However this is not a very preferred method of doing things, For example Double Click event will be fired even if the user double clicks on an empty region of the Grid,
Why don't you allow the user to Edit the Data in place, in the Grid itself...
ASKER
arif_eqbal,
I could not agree with you more, on possibly letting the users edit the grid on the grid itself, however, for this application, this is totally out of the question. When the user double clicks the grid, it fires off that "form" I was talking about, which in return contains a relationship recordset to make even more calls to SQL. When I get this project done, I could let you download the source, and I will make it available on EE for others to see.
Anyhow, its fine even if the cell is empty, as long as when they doubleclick the grid it sends the details to the form pertaining to the row clicked. Actually, in some cases, some of the values may be null to begin with, so this should work just fine. I am going to try your method, and get back with you.
Thanks again, I will be in touch.
I could not agree with you more, on possibly letting the users edit the grid on the grid itself, however, for this application, this is totally out of the question. When the user double clicks the grid, it fires off that "form" I was talking about, which in return contains a relationship recordset to make even more calls to SQL. When I get this project done, I could let you download the source, and I will make it available on EE for others to see.
Anyhow, its fine even if the cell is empty, as long as when they doubleclick the grid it sends the details to the form pertaining to the row clicked. Actually, in some cases, some of the values may be null to begin with, so this should work just fine. I am going to try your method, and get back with you.
Thanks again, I will be in touch.
ASKER
DataTable1 is not Delared
Frm.ShowData is not a member of "PROJECTNAME"
Frm.ShowData is not a member of "PROJECTNAME"
Well DataTable1 was just a dummy name I used
You need to replace it with the DataTable Used by you.
Also ShowData function that I have written must be put on the Form where you need to show the data...
You need to replace it with the DataTable Used by you.
Also ShowData function that I have written must be put on the Form where you need to show the data...
ASKER
'Rows' is not a member of 'System.Windows.Forms.Data Grid'.
=============CODE========= ====
Private Sub grdToolTracker_Navigate(By Val sender As System.Object, ByVal ne As System.Windows.Forms.Navig ateEventAr gs) Handles grdToolTracker.Navigate
Dim DR As DataRow
DR = grdToolTracker.Rows(DataGr id.Current RowIndex)
Dim Frm As New frmToolTracker_EditTool()
Frm.Showdata(DR)
Frm.Show()
End Sub
=========END CODE=============
Option Strict On disallows implicit conversions from 'System.Object' to 'String'.
The above error is in reference to "Dr(0)"
=============CODE========= ====
Public Sub Showdata(ByVal Dr As DataRow)
txtToolID.Text = Dr(0)
txtToolNumber.Text = Dr(1)
End Sub
========================== ====
=============CODE=========
Private Sub grdToolTracker_Navigate(By
Dim DR As DataRow
DR = grdToolTracker.Rows(DataGr
Dim Frm As New frmToolTracker_EditTool()
Frm.Showdata(DR)
Frm.Show()
End Sub
=========END CODE=============
Option Strict On disallows implicit conversions from 'System.Object' to 'String'.
The above error is in reference to "Dr(0)"
=============CODE=========
Public Sub Showdata(ByVal Dr As DataRow)
txtToolID.Text = Dr(0)
txtToolNumber.Text = Dr(1)
End Sub
==========================
ASKER
on the option strict, that was my mistake. I forgot to put Option Strict Off in the code
Your datagrid should be bound to a typed dataset.
Create the popup as a new form bound to the same typed dataset.
In the original form include an event handler for the grid's mouse down event:
Private Sub DataGrid1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.Mouse EventArgs) Handles DataGrid1.MouseDown
If e.Clicks = 2 AndAlso Me.DataGrid1.HitTest(e.X, e.Y).Row > -1 Then 'Double clicked the row selector
Dim popup As New Form2
popup.Dataset11.Merge(Me.D ataset11)
popup.BindingContext.Item( popup.Data set11, "table1").Position = Me.DataGrid1.HitTest(e.X, e.Y).Row
popup.ShowDialog()
Me.Dataset11.Clear()
Me.Dataset11.Merge(popup.D ataset11)
End If
End Sub
Create the popup as a new form bound to the same typed dataset.
In the original form include an event handler for the grid's mouse down event:
Private Sub DataGrid1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.Mouse
If e.Clicks = 2 AndAlso Me.DataGrid1.HitTest(e.X, e.Y).Row > -1 Then 'Double clicked the row selector
Dim popup As New Form2
popup.Dataset11.Merge(Me.D
popup.BindingContext.Item(
popup.ShowDialog()
Me.Dataset11.Clear()
Me.Dataset11.Merge(popup.D
End If
End Sub
ASKER
when you say original form, you are refering to the actual datagrid form page correct?
Yes.
ASKER
Gotcha. I have already spend a lot of time coding the form I want to open, with the doubleclick event. It is called frmToolTracker_EditTool
Is there a way I can confirm it is bound, or if it is not, to do this. I am very new to .NET
Is there a way I can confirm it is bound, or if it is not, to do this. I am very new to .NET
ASKER
Here is the form I want to open when that datagrid is doubleclicked
Option Strict Off
Imports System.Data.SqlClient
Public Class frmToolTracker_EditTool
Inherits System.Windows.Forms.Form
Protected ToolingData As New DataSet()
Protected Const SQL_CONNECTION_STRING As String = _
"Server=localhost;" & _
"DataBase=Triumph;" & _
"Integrated Security=SSPI"
Protected didPreviouslyConnect As Boolean = False
Protected connectionString As String = SQL_CONNECTION_STRING
' Used to reference the table containing product information in
' ProductData.
Protected Const TOOLING_TABLE_NAME As String = "TL_Events"
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon tainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents btnClose As System.Windows.Forms.Butto n
Friend WithEvents btnSave As System.Windows.Forms.Butto n
Friend WithEvents txtCT3 As System.Windows.Forms.TextB ox
Friend WithEvents txtCT2 As System.Windows.Forms.TextB ox
Friend WithEvents txtCT1 As System.Windows.Forms.TextB ox
Friend WithEvents txtToolValue As System.Windows.Forms.TextB ox
Friend WithEvents txtTolerance As System.Windows.Forms.TextB ox
Friend WithEvents txtCalibrationFreq As System.Windows.Forms.TextB ox
Friend WithEvents txtEntryDate As System.Windows.Forms.TextB ox
Friend WithEvents txtEntryPerson As System.Windows.Forms.TextB ox
Friend WithEvents cmbStatus As System.Windows.Forms.Combo Box
Friend WithEvents lblToolValue As System.Windows.Forms.Label
Friend WithEvents lblTolerance As System.Windows.Forms.Label
Friend WithEvents lblCalibrationTarget As System.Windows.Forms.Label
Friend WithEvents lblCalibrationFreq As System.Windows.Forms.Label
Friend WithEvents lblEntryDate As System.Windows.Forms.Label
Friend WithEvents lblEntryPerson As System.Windows.Forms.Label
Friend WithEvents lblStatus As System.Windows.Forms.Label
Friend WithEvents txtPieces As System.Windows.Forms.TextB ox
Friend WithEvents txtToolOwner As System.Windows.Forms.TextB ox
Friend WithEvents txtLocation As System.Windows.Forms.TextB ox
Friend WithEvents txtDescription As System.Windows.Forms.TextB ox
Friend WithEvents txtSerialNumber As System.Windows.Forms.TextB ox
Friend WithEvents txtToolNumber As System.Windows.Forms.TextB ox
Friend WithEvents txtToolID As System.Windows.Forms.TextB ox
Friend WithEvents lblPieces As System.Windows.Forms.Label
Friend WithEvents lblToolOwner As System.Windows.Forms.Label
Friend WithEvents lblSameCust As System.Windows.Forms.Label
Friend WithEvents lblCustomer As System.Windows.Forms.Label
Friend WithEvents lblLocation As System.Windows.Forms.Label
Friend WithEvents lblDescription As System.Windows.Forms.Label
Friend WithEvents lblSerialNumber As System.Windows.Forms.Label
Friend WithEvents lblToolNumber As System.Windows.Forms.Label
Friend WithEvents lblToolID As System.Windows.Forms.Label
Friend WithEvents grpboxComments As System.Windows.Forms.Group Box
Friend WithEvents btnAddEvent As System.Windows.Forms.Butto n
Friend WithEvents btnRedTag As System.Windows.Forms.Butto n
Friend WithEvents rtbComments As System.Windows.Forms.RichT extBox
Friend WithEvents grdEvent As System.Windows.Forms.DataG rid
Friend WithEvents GroupBox1 As System.Windows.Forms.Group Box
Friend WithEvents btnLoad As System.Windows.Forms.Butto n
<System.Diagnostics.Debugg erStepThro ugh()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceM anager = New System.Resources.ResourceM anager(Get Type(frmTo olTracker_ EditTool))
Me.btnClose = New System.Windows.Forms.Butto n()
Me.btnSave = New System.Windows.Forms.Butto n()
Me.txtCT3 = New System.Windows.Forms.TextB ox()
Me.txtCT2 = New System.Windows.Forms.TextB ox()
Me.txtCT1 = New System.Windows.Forms.TextB ox()
Me.txtToolValue = New System.Windows.Forms.TextB ox()
Me.txtTolerance = New System.Windows.Forms.TextB ox()
Me.txtCalibrationFreq = New System.Windows.Forms.TextB ox()
Me.txtEntryDate = New System.Windows.Forms.TextB ox()
Me.txtEntryPerson = New System.Windows.Forms.TextB ox()
Me.cmbStatus = New System.Windows.Forms.Combo Box()
Me.lblToolValue = New System.Windows.Forms.Label ()
Me.lblTolerance = New System.Windows.Forms.Label ()
Me.lblCalibrationTarget = New System.Windows.Forms.Label ()
Me.lblCalibrationFreq = New System.Windows.Forms.Label ()
Me.lblEntryDate = New System.Windows.Forms.Label ()
Me.lblEntryPerson = New System.Windows.Forms.Label ()
Me.lblStatus = New System.Windows.Forms.Label ()
Me.txtPieces = New System.Windows.Forms.TextB ox()
Me.txtToolOwner = New System.Windows.Forms.TextB ox()
Me.txtLocation = New System.Windows.Forms.TextB ox()
Me.txtDescription = New System.Windows.Forms.TextB ox()
Me.txtSerialNumber = New System.Windows.Forms.TextB ox()
Me.txtToolNumber = New System.Windows.Forms.TextB ox()
Me.txtToolID = New System.Windows.Forms.TextB ox()
Me.lblPieces = New System.Windows.Forms.Label ()
Me.lblToolOwner = New System.Windows.Forms.Label ()
Me.lblSameCust = New System.Windows.Forms.Label ()
Me.lblCustomer = New System.Windows.Forms.Label ()
Me.lblLocation = New System.Windows.Forms.Label ()
Me.lblDescription = New System.Windows.Forms.Label ()
Me.lblSerialNumber = New System.Windows.Forms.Label ()
Me.lblToolNumber = New System.Windows.Forms.Label ()
Me.lblToolID = New System.Windows.Forms.Label ()
Me.grdEvent = New System.Windows.Forms.DataG rid()
Me.grpboxComments = New System.Windows.Forms.Group Box()
Me.rtbComments = New System.Windows.Forms.RichT extBox()
Me.btnAddEvent = New System.Windows.Forms.Butto n()
Me.btnRedTag = New System.Windows.Forms.Butto n()
Me.GroupBox1 = New System.Windows.Forms.Group Box()
Me.btnLoad = New System.Windows.Forms.Butto n()
CType(Me.grdEvent, System.ComponentModel.ISup portInitia lize).Begi nInit()
Me.grpboxComments.SuspendL ayout()
Me.GroupBox1.SuspendLayout ()
Me.SuspendLayout()
'
'btnClose
'
Me.btnClose.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.btnClose.Location = New System.Drawing.Point(192, 512)
Me.btnClose.Name = "btnClose"
Me.btnClose.TabIndex = 71
Me.btnClose.Text = "&Close"
'
'btnSave
'
Me.btnSave.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.btnSave.Location = New System.Drawing.Point(88, 512)
Me.btnSave.Name = "btnSave"
Me.btnSave.TabIndex = 70
Me.btnSave.Text = "&Save"
'
'txtCT3
'
Me.txtCT3.Location = New System.Drawing.Point(632, 123)
Me.txtCT3.Name = "txtCT3"
Me.txtCT3.Size = New System.Drawing.Size(44, 20)
Me.txtCT3.TabIndex = 67
Me.txtCT3.Text = ""
'
'txtCT2
'
Me.txtCT2.Location = New System.Drawing.Point(576, 123)
Me.txtCT2.Name = "txtCT2"
Me.txtCT2.Size = New System.Drawing.Size(44, 20)
Me.txtCT2.TabIndex = 66
Me.txtCT2.Text = ""
'
'txtCT1
'
Me.txtCT1.Location = New System.Drawing.Point(520, 123)
Me.txtCT1.Name = "txtCT1"
Me.txtCT1.Size = New System.Drawing.Size(44, 20)
Me.txtCT1.TabIndex = 65
Me.txtCT1.Text = ""
'
'txtToolValue
'
Me.txtToolValue.Location = New System.Drawing.Point(520, 171)
Me.txtToolValue.Name = "txtToolValue"
Me.txtToolValue.Size = New System.Drawing.Size(144, 20)
Me.txtToolValue.TabIndex = 64
Me.txtToolValue.Text = ""
'
'txtTolerance
'
Me.txtTolerance.Location = New System.Drawing.Point(520, 147)
Me.txtTolerance.Name = "txtTolerance"
Me.txtTolerance.Size = New System.Drawing.Size(144, 20)
Me.txtTolerance.TabIndex = 63
Me.txtTolerance.Text = ""
'
'txtCalibrationFreq
'
Me.txtCalibrationFreq.Loca tion = New System.Drawing.Point(520, 99)
Me.txtCalibrationFreq.Name = "txtCalibrationFreq"
Me.txtCalibrationFreq.Size = New System.Drawing.Size(88, 20)
Me.txtCalibrationFreq.TabI ndex = 62
Me.txtCalibrationFreq.Text = ""
'
'txtEntryDate
'
Me.txtEntryDate.Location = New System.Drawing.Point(520, 75)
Me.txtEntryDate.Name = "txtEntryDate"
Me.txtEntryDate.Size = New System.Drawing.Size(144, 20)
Me.txtEntryDate.TabIndex = 61
Me.txtEntryDate.Text = ""
'
'txtEntryPerson
'
Me.txtEntryPerson.Location = New System.Drawing.Point(520, 51)
Me.txtEntryPerson.Name = "txtEntryPerson"
Me.txtEntryPerson.Size = New System.Drawing.Size(144, 20)
Me.txtEntryPerson.TabIndex = 60
Me.txtEntryPerson.Text = ""
'
'cmbStatus
'
Me.cmbStatus.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.cmbStatus.Items.AddRang e(New Object() {"INHOUSE", "ENGINEER"})
Me.cmbStatus.Location = New System.Drawing.Point(520, 27)
Me.cmbStatus.Name = "cmbStatus"
Me.cmbStatus.Size = New System.Drawing.Size(176, 21)
Me.cmbStatus.TabIndex = 59
'
'lblToolValue
'
Me.lblToolValue.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblToolValue.Location = New System.Drawing.Point(392, 171)
Me.lblToolValue.Name = "lblToolValue"
Me.lblToolValue.Size = New System.Drawing.Size(120, 16)
Me.lblToolValue.TabIndex = 58
Me.lblToolValue.Text = "Tool Value:"
Me.lblToolValue.TextAlign = System.Drawing.ContentAlig nment.TopR ight
'
'lblTolerance
'
Me.lblTolerance.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblTolerance.Location = New System.Drawing.Point(392, 147)
Me.lblTolerance.Name = "lblTolerance"
Me.lblTolerance.Size = New System.Drawing.Size(120, 16)
Me.lblTolerance.TabIndex = 57
Me.lblTolerance.Text = "Tolerance:"
Me.lblTolerance.TextAlign = System.Drawing.ContentAlig nment.TopR ight
'
'lblCalibrationTarget
'
Me.lblCalibrationTarget.Fo nt = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblCalibrationTarget.Lo cation = New System.Drawing.Point(392, 123)
Me.lblCalibrationTarget.Na me = "lblCalibrationTarget"
Me.lblCalibrationTarget.Si ze = New System.Drawing.Size(120, 16)
Me.lblCalibrationTarget.Ta bIndex = 56
Me.lblCalibrationTarget.Te xt = "Calibration Target:"
Me.lblCalibrationTarget.Te xtAlign = System.Drawing.ContentAlig nment.TopR ight
'
'lblCalibrationFreq
'
Me.lblCalibrationFreq.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblCalibrationFreq.Loca tion = New System.Drawing.Point(392, 99)
Me.lblCalibrationFreq.Name = "lblCalibrationFreq"
Me.lblCalibrationFreq.Size = New System.Drawing.Size(120, 16)
Me.lblCalibrationFreq.TabI ndex = 55
Me.lblCalibrationFreq.Text = "Calibration Freq:"
Me.lblCalibrationFreq.Text Align = System.Drawing.ContentAlig nment.TopR ight
'
'lblEntryDate
'
Me.lblEntryDate.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblEntryDate.Location = New System.Drawing.Point(392, 75)
Me.lblEntryDate.Name = "lblEntryDate"
Me.lblEntryDate.Size = New System.Drawing.Size(120, 16)
Me.lblEntryDate.TabIndex = 54
Me.lblEntryDate.Text = "Entry Date:"
Me.lblEntryDate.TextAlign = System.Drawing.ContentAlig nment.TopR ight
'
'lblEntryPerson
'
Me.lblEntryPerson.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblEntryPerson.Location = New System.Drawing.Point(392, 51)
Me.lblEntryPerson.Name = "lblEntryPerson"
Me.lblEntryPerson.Size = New System.Drawing.Size(120, 16)
Me.lblEntryPerson.TabIndex = 53
Me.lblEntryPerson.Text = "Entry Person:"
Me.lblEntryPerson.TextAlig n = System.Drawing.ContentAlig nment.TopR ight
'
'lblStatus
'
Me.lblStatus.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblStatus.Location = New System.Drawing.Point(392, 27)
Me.lblStatus.Name = "lblStatus"
Me.lblStatus.Size = New System.Drawing.Size(120, 16)
Me.lblStatus.TabIndex = 52
Me.lblStatus.Text = "Status:"
Me.lblStatus.TextAlign = System.Drawing.ContentAlig nment.TopR ight
'
'txtPieces
'
Me.txtPieces.Location = New System.Drawing.Point(136, 219)
Me.txtPieces.Name = "txtPieces"
Me.txtPieces.Size = New System.Drawing.Size(48, 20)
Me.txtPieces.TabIndex = 51
Me.txtPieces.Text = ""
'
'txtToolOwner
'
Me.txtToolOwner.Location = New System.Drawing.Point(136, 195)
Me.txtToolOwner.Name = "txtToolOwner"
Me.txtToolOwner.Size = New System.Drawing.Size(168, 20)
Me.txtToolOwner.TabIndex = 50
Me.txtToolOwner.Text = ""
'
'txtLocation
'
Me.txtLocation.Location = New System.Drawing.Point(136, 123)
Me.txtLocation.Name = "txtLocation"
Me.txtLocation.Size = New System.Drawing.Size(168, 20)
Me.txtLocation.TabIndex = 49
Me.txtLocation.Text = ""
'
'txtDescription
'
Me.txtDescription.Location = New System.Drawing.Point(136, 99)
Me.txtDescription.Name = "txtDescription"
Me.txtDescription.Size = New System.Drawing.Size(168, 20)
Me.txtDescription.TabIndex = 48
Me.txtDescription.Text = ""
'
'txtSerialNumber
'
Me.txtSerialNumber.Locatio n = New System.Drawing.Point(136, 75)
Me.txtSerialNumber.Name = "txtSerialNumber"
Me.txtSerialNumber.Size = New System.Drawing.Size(168, 20)
Me.txtSerialNumber.TabInde x = 47
Me.txtSerialNumber.Text = ""
'
'txtToolNumber
'
Me.txtToolNumber.Location = New System.Drawing.Point(136, 51)
Me.txtToolNumber.Name = "txtToolNumber"
Me.txtToolNumber.Size = New System.Drawing.Size(168, 20)
Me.txtToolNumber.TabIndex = 46
Me.txtToolNumber.Text = ""
'
'txtToolID
'
Me.txtToolID.Location = New System.Drawing.Point(136, 27)
Me.txtToolID.Name = "txtToolID"
Me.txtToolID.Size = New System.Drawing.Size(168, 20)
Me.txtToolID.TabIndex = 45
Me.txtToolID.Text = ""
'
'lblPieces
'
Me.lblPieces.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblPieces.Location = New System.Drawing.Point(8, 219)
Me.lblPieces.Name = "lblPieces"
Me.lblPieces.Size = New System.Drawing.Size(120, 16)
Me.lblPieces.TabIndex = 44
Me.lblPieces.Text = "Pieces:"
Me.lblPieces.TextAlign = System.Drawing.ContentAlig nment.TopR ight
'
'lblToolOwner
'
Me.lblToolOwner.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblToolOwner.Location = New System.Drawing.Point(8, 195)
Me.lblToolOwner.Name = "lblToolOwner"
Me.lblToolOwner.Size = New System.Drawing.Size(120, 16)
Me.lblToolOwner.TabIndex = 43
Me.lblToolOwner.Text = "Tool Owner:"
Me.lblToolOwner.TextAlign = System.Drawing.ContentAlig nment.TopR ight
'
'lblSameCust
'
Me.lblSameCust.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblSameCust.Location = New System.Drawing.Point(8, 171)
Me.lblSameCust.Name = "lblSameCust"
Me.lblSameCust.Size = New System.Drawing.Size(120, 16)
Me.lblSameCust.TabIndex = 42
Me.lblSameCust.Text = "Same Cust/Owner:"
Me.lblSameCust.TextAlign = System.Drawing.ContentAlig nment.TopR ight
'
'lblCustomer
'
Me.lblCustomer.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblCustomer.Location = New System.Drawing.Point(8, 147)
Me.lblCustomer.Name = "lblCustomer"
Me.lblCustomer.Size = New System.Drawing.Size(120, 16)
Me.lblCustomer.TabIndex = 41
Me.lblCustomer.Text = "Customer:"
Me.lblCustomer.TextAlign = System.Drawing.ContentAlig nment.TopR ight
'
'lblLocation
'
Me.lblLocation.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblLocation.Location = New System.Drawing.Point(8, 123)
Me.lblLocation.Name = "lblLocation"
Me.lblLocation.Size = New System.Drawing.Size(120, 16)
Me.lblLocation.TabIndex = 40
Me.lblLocation.Text = "Location:"
Me.lblLocation.TextAlign = System.Drawing.ContentAlig nment.TopR ight
'
'lblDescription
'
Me.lblDescription.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblDescription.Location = New System.Drawing.Point(8, 99)
Me.lblDescription.Name = "lblDescription"
Me.lblDescription.Size = New System.Drawing.Size(120, 16)
Me.lblDescription.TabIndex = 39
Me.lblDescription.Text = "Description:"
Me.lblDescription.TextAlig n = System.Drawing.ContentAlig nment.TopR ight
'
'lblSerialNumber
'
Me.lblSerialNumber.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblSerialNumber.Locatio n = New System.Drawing.Point(8, 75)
Me.lblSerialNumber.Name = "lblSerialNumber"
Me.lblSerialNumber.Size = New System.Drawing.Size(120, 16)
Me.lblSerialNumber.TabInde x = 38
Me.lblSerialNumber.Text = "Serial Number:"
Me.lblSerialNumber.TextAli gn = System.Drawing.ContentAlig nment.TopR ight
'
'lblToolNumber
'
Me.lblToolNumber.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblToolNumber.Location = New System.Drawing.Point(8, 51)
Me.lblToolNumber.Name = "lblToolNumber"
Me.lblToolNumber.Size = New System.Drawing.Size(120, 16)
Me.lblToolNumber.TabIndex = 37
Me.lblToolNumber.Text = "Tool Number:"
Me.lblToolNumber.TextAlign = System.Drawing.ContentAlig nment.TopR ight
'
'lblToolID
'
Me.lblToolID.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.lblToolID.Location = New System.Drawing.Point(8, 27)
Me.lblToolID.Name = "lblToolID"
Me.lblToolID.Size = New System.Drawing.Size(120, 16)
Me.lblToolID.TabIndex = 36
Me.lblToolID.Text = "Tool ID:"
Me.lblToolID.TextAlign = System.Drawing.ContentAlig nment.TopR ight
'
'grdEvent
'
Me.grdEvent.Anchor = (((System.Windows.Forms.An chorStyles .Top Or System.Windows.Forms.Ancho rStyles.Bo ttom) _
Or System.Windows.Forms.Ancho rStyles.Le ft) _
Or System.Windows.Forms.Ancho rStyles.Ri ght)
Me.grdEvent.DataMember = ""
Me.grdEvent.HeaderForeColo r = System.Drawing.SystemColor s.ControlT ext
Me.grdEvent.Location = New System.Drawing.Point(8, 16)
Me.grdEvent.Name = "grdEvent"
Me.grdEvent.ReadOnly = True
Me.grdEvent.Size = New System.Drawing.Size(648, 120)
Me.grdEvent.TabIndex = 72
'
'grpboxComments
'
Me.grpboxComments.Controls .AddRange( New System.Windows.Forms.Contr ol() {Me.rtbComments})
Me.grpboxComments.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.grpboxComments.Location = New System.Drawing.Point(16, 248)
Me.grpboxComments.Name = "grpboxComments"
Me.grpboxComments.Size = New System.Drawing.Size(664, 80)
Me.grpboxComments.TabIndex = 73
Me.grpboxComments.TabStop = False
Me.grpboxComments.Text = "Comments:"
'
'rtbComments
'
Me.rtbComments.Location = New System.Drawing.Point(8, 16)
Me.rtbComments.Name = "rtbComments"
Me.rtbComments.Size = New System.Drawing.Size(648, 56)
Me.rtbComments.TabIndex = 0
Me.rtbComments.Text = ""
'
'btnAddEvent
'
Me.btnAddEvent.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.btnAddEvent.Location = New System.Drawing.Point(88, 336)
Me.btnAddEvent.Name = "btnAddEvent"
Me.btnAddEvent.TabIndex = 74
Me.btnAddEvent.Text = "Add &Event:"
'
'btnRedTag
'
Me.btnRedTag.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.btnRedTag.Location = New System.Drawing.Point(184, 336)
Me.btnRedTag.Name = "btnRedTag"
Me.btnRedTag.Size = New System.Drawing.Size(96, 23)
Me.btnRedTag.TabIndex = 75
Me.btnRedTag.Text = "Add &Red Tag:"
'
'GroupBox1
'
Me.GroupBox1.Controls.AddR ange(New System.Windows.Forms.Contr ol() {Me.grdEvent})
Me.GroupBox1.Font = New System.Drawing.Font("Micro soft Sans Serif", 8.25!, System.Drawing.FontStyle.B old, System.Drawing.GraphicsUni t.Point, CType(0, Byte))
Me.GroupBox1.Location = New System.Drawing.Point(16, 368)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(664, 144)
Me.GroupBox1.TabIndex = 76
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Events:"
'
'btnLoad
'
Me.btnLoad.Location = New System.Drawing.Point(560, 568)
Me.btnLoad.Name = "btnLoad"
Me.btnLoad.TabIndex = 77
Me.btnLoad.Text = "Load"
'
'frmToolTracker_EditTool
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(704, 541)
Me.Controls.AddRange(New System.Windows.Forms.Contr ol() {Me.btnLoad, Me.GroupBox1, Me.btnRedTag, Me.btnAddEvent, Me.grpboxComments, Me.btnClose, Me.btnSave, Me.txtCT3, Me.txtCT2, Me.txtCT1, Me.txtToolValue, Me.txtTolerance, Me.txtCalibrationFreq, Me.txtEntryDate, Me.txtEntryPerson, Me.cmbStatus, Me.lblToolValue, Me.lblTolerance, Me.lblCalibrationTarget, Me.lblCalibrationFreq, Me.lblEntryDate, Me.lblEntryPerson, Me.lblStatus, Me.txtPieces, Me.txtToolOwner, Me.txtLocation, Me.txtDescription, Me.txtSerialNumber, Me.txtToolNumber, Me.txtToolID, Me.lblPieces, Me.lblToolOwner, Me.lblSameCust, Me.lblCustomer, Me.lblLocation, Me.lblDescription, Me.lblSerialNumber, Me.lblToolNumber, Me.lblToolID})
Me.Icon = CType(resources.GetObject( "$this.Ico n"), System.Drawing.Icon)
Me.Name = "frmToolTracker_EditTool"
Me.Text = "Tool Tracker: Edit Tool"
CType(Me.grdEvent, System.ComponentModel.ISup portInitia lize).EndI nit()
Me.grpboxComments.ResumeLa yout(False )
Me.GroupBox1.ResumeLayout( False)
Me.ResumeLayout(False)
End Sub
#End Region
Public Sub Showdata(ByVal Dr As DataRow)
txtToolID.Text = Dr(0)
txtToolNumber.Text = Dr(1)
End Sub
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
Dim frmStatusMessage As New frmStatus()
If Not didPreviouslyConnect Then
frmStatusMessage.Show("Con necting to SQL Server")
End If
Dim isConnecting As Boolean = True
While isConnecting
Try
Dim ToolTracker_EventsConnecti on As New SqlConnection(connectionSt ring)
' The SqlDataAdapter is used to move data between SQL Server,
' and a DataSet.
Dim ProductAdapter As New SqlDataAdapter( _
"select * from TL_Events", _
ToolTracker_EventsConnecti on)
' Clear out any old data that has been previously loaded into
' the DataSet
ToolingData.Clear()
' Populate the DataSet with the information from the products
' table. Since a DataSet can hold multiple result sets, it's
' a good idea to "name" the result set when you populate the
' DataSet. In this case, the result set is named "Products".
ProductAdapter.Fill(Toolin gData, TOOLING_TABLE_NAME)
' Bind the DataGrid to the desired table in the DataSet. This
' will cause the product information to display.
grdEvent.DataSource = ToolingData.Tables(TOOLING _TABLE_NAM E)
'//////////Hide columns in SQL that don't want user to see
Dim TS As New DataGridTableStyle()
TS.MappingName = TOOLING_TABLE_NAME
Dim Col As New DataGridTextBoxColumn()
Col.MappingName = "EventID"
Col.HeaderText = "EventID"
Col.Width = 100
TS.GridColumnStyles.Add(Co l)
Col = New DataGridTextBoxColumn()
Col.MappingName = "ToolID"
Col.HeaderText = "ToolID"
Col.Width = 100
TS.GridColumnStyles.Add(Co l)
Col = New DataGridTextBoxColumn()
Col.MappingName = "EntryType"
Col.HeaderText = "EntryType"
Col.Width = 100
TS.GridColumnStyles.Add(Co l)
Col = New DataGridTextBoxColumn()
Col.MappingName = "EntryPerson"
Col.HeaderText = "EntryPerson"
Col.Width = 100
TS.GridColumnStyles.Add(Co l)
Col = New DataGridTextBoxColumn()
Col.MappingName = "Comments"
Col.HeaderText = "Comments"
Col.Width = 100
TS.GridColumnStyles.Add(Co l)
Col = New DataGridTextBoxColumn()
Col.MappingName = "EntryDate"
Col.HeaderText = "EntryDate"
Col.Width = 100
TS.GridColumnStyles.Add(Co l)
grdEvent.TableStyles.Add(T S)
'//////////End Hide Columns
' Now that the grid is populated, let the user filter the results.
isConnecting = False
Catch exc As Exception
If connectionString = SQL_CONNECTION_STRING Then
' Couldn't connect to SQL Server. Kill The Connection.
frmStatusMessage.Show("Con nection Dead, Killing Tool Tracker")
End
End If
End Try
End While
frmStatusMessage.Close()
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Me.Close()
End Sub
Private Sub btnRedTag_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRedTag.Click
' Open the Red Tag Form
Dim frmToolTracker_RedTag As New frmToolTracker_RedTag()
frmToolTracker_RedTag.Show Dialog(Me)
frmToolTracker_RedTag.Disp ose()
End Sub
End Class
Option Strict Off
Imports System.Data.SqlClient
Public Class frmToolTracker_EditTool
Inherits System.Windows.Forms.Form
Protected ToolingData As New DataSet()
Protected Const SQL_CONNECTION_STRING As String = _
"Server=localhost;" & _
"DataBase=Triumph;" & _
"Integrated Security=SSPI"
Protected didPreviouslyConnect As Boolean = False
Protected connectionString As String = SQL_CONNECTION_STRING
' Used to reference the table containing product information in
' ProductData.
Protected Const TOOLING_TABLE_NAME As String = "TL_Events"
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents btnClose As System.Windows.Forms.Butto
Friend WithEvents btnSave As System.Windows.Forms.Butto
Friend WithEvents txtCT3 As System.Windows.Forms.TextB
Friend WithEvents txtCT2 As System.Windows.Forms.TextB
Friend WithEvents txtCT1 As System.Windows.Forms.TextB
Friend WithEvents txtToolValue As System.Windows.Forms.TextB
Friend WithEvents txtTolerance As System.Windows.Forms.TextB
Friend WithEvents txtCalibrationFreq As System.Windows.Forms.TextB
Friend WithEvents txtEntryDate As System.Windows.Forms.TextB
Friend WithEvents txtEntryPerson As System.Windows.Forms.TextB
Friend WithEvents cmbStatus As System.Windows.Forms.Combo
Friend WithEvents lblToolValue As System.Windows.Forms.Label
Friend WithEvents lblTolerance As System.Windows.Forms.Label
Friend WithEvents lblCalibrationTarget As System.Windows.Forms.Label
Friend WithEvents lblCalibrationFreq As System.Windows.Forms.Label
Friend WithEvents lblEntryDate As System.Windows.Forms.Label
Friend WithEvents lblEntryPerson As System.Windows.Forms.Label
Friend WithEvents lblStatus As System.Windows.Forms.Label
Friend WithEvents txtPieces As System.Windows.Forms.TextB
Friend WithEvents txtToolOwner As System.Windows.Forms.TextB
Friend WithEvents txtLocation As System.Windows.Forms.TextB
Friend WithEvents txtDescription As System.Windows.Forms.TextB
Friend WithEvents txtSerialNumber As System.Windows.Forms.TextB
Friend WithEvents txtToolNumber As System.Windows.Forms.TextB
Friend WithEvents txtToolID As System.Windows.Forms.TextB
Friend WithEvents lblPieces As System.Windows.Forms.Label
Friend WithEvents lblToolOwner As System.Windows.Forms.Label
Friend WithEvents lblSameCust As System.Windows.Forms.Label
Friend WithEvents lblCustomer As System.Windows.Forms.Label
Friend WithEvents lblLocation As System.Windows.Forms.Label
Friend WithEvents lblDescription As System.Windows.Forms.Label
Friend WithEvents lblSerialNumber As System.Windows.Forms.Label
Friend WithEvents lblToolNumber As System.Windows.Forms.Label
Friend WithEvents lblToolID As System.Windows.Forms.Label
Friend WithEvents grpboxComments As System.Windows.Forms.Group
Friend WithEvents btnAddEvent As System.Windows.Forms.Butto
Friend WithEvents btnRedTag As System.Windows.Forms.Butto
Friend WithEvents rtbComments As System.Windows.Forms.RichT
Friend WithEvents grdEvent As System.Windows.Forms.DataG
Friend WithEvents GroupBox1 As System.Windows.Forms.Group
Friend WithEvents btnLoad As System.Windows.Forms.Butto
<System.Diagnostics.Debugg
Dim resources As System.Resources.ResourceM
Me.btnClose = New System.Windows.Forms.Butto
Me.btnSave = New System.Windows.Forms.Butto
Me.txtCT3 = New System.Windows.Forms.TextB
Me.txtCT2 = New System.Windows.Forms.TextB
Me.txtCT1 = New System.Windows.Forms.TextB
Me.txtToolValue = New System.Windows.Forms.TextB
Me.txtTolerance = New System.Windows.Forms.TextB
Me.txtCalibrationFreq = New System.Windows.Forms.TextB
Me.txtEntryDate = New System.Windows.Forms.TextB
Me.txtEntryPerson = New System.Windows.Forms.TextB
Me.cmbStatus = New System.Windows.Forms.Combo
Me.lblToolValue = New System.Windows.Forms.Label
Me.lblTolerance = New System.Windows.Forms.Label
Me.lblCalibrationTarget = New System.Windows.Forms.Label
Me.lblCalibrationFreq = New System.Windows.Forms.Label
Me.lblEntryDate = New System.Windows.Forms.Label
Me.lblEntryPerson = New System.Windows.Forms.Label
Me.lblStatus = New System.Windows.Forms.Label
Me.txtPieces = New System.Windows.Forms.TextB
Me.txtToolOwner = New System.Windows.Forms.TextB
Me.txtLocation = New System.Windows.Forms.TextB
Me.txtDescription = New System.Windows.Forms.TextB
Me.txtSerialNumber = New System.Windows.Forms.TextB
Me.txtToolNumber = New System.Windows.Forms.TextB
Me.txtToolID = New System.Windows.Forms.TextB
Me.lblPieces = New System.Windows.Forms.Label
Me.lblToolOwner = New System.Windows.Forms.Label
Me.lblSameCust = New System.Windows.Forms.Label
Me.lblCustomer = New System.Windows.Forms.Label
Me.lblLocation = New System.Windows.Forms.Label
Me.lblDescription = New System.Windows.Forms.Label
Me.lblSerialNumber = New System.Windows.Forms.Label
Me.lblToolNumber = New System.Windows.Forms.Label
Me.lblToolID = New System.Windows.Forms.Label
Me.grdEvent = New System.Windows.Forms.DataG
Me.grpboxComments = New System.Windows.Forms.Group
Me.rtbComments = New System.Windows.Forms.RichT
Me.btnAddEvent = New System.Windows.Forms.Butto
Me.btnRedTag = New System.Windows.Forms.Butto
Me.GroupBox1 = New System.Windows.Forms.Group
Me.btnLoad = New System.Windows.Forms.Butto
CType(Me.grdEvent, System.ComponentModel.ISup
Me.grpboxComments.SuspendL
Me.GroupBox1.SuspendLayout
Me.SuspendLayout()
'
'btnClose
'
Me.btnClose.Font = New System.Drawing.Font("Micro
Me.btnClose.Location = New System.Drawing.Point(192, 512)
Me.btnClose.Name = "btnClose"
Me.btnClose.TabIndex = 71
Me.btnClose.Text = "&Close"
'
'btnSave
'
Me.btnSave.Font = New System.Drawing.Font("Micro
Me.btnSave.Location = New System.Drawing.Point(88, 512)
Me.btnSave.Name = "btnSave"
Me.btnSave.TabIndex = 70
Me.btnSave.Text = "&Save"
'
'txtCT3
'
Me.txtCT3.Location = New System.Drawing.Point(632, 123)
Me.txtCT3.Name = "txtCT3"
Me.txtCT3.Size = New System.Drawing.Size(44, 20)
Me.txtCT3.TabIndex = 67
Me.txtCT3.Text = ""
'
'txtCT2
'
Me.txtCT2.Location = New System.Drawing.Point(576, 123)
Me.txtCT2.Name = "txtCT2"
Me.txtCT2.Size = New System.Drawing.Size(44, 20)
Me.txtCT2.TabIndex = 66
Me.txtCT2.Text = ""
'
'txtCT1
'
Me.txtCT1.Location = New System.Drawing.Point(520, 123)
Me.txtCT1.Name = "txtCT1"
Me.txtCT1.Size = New System.Drawing.Size(44, 20)
Me.txtCT1.TabIndex = 65
Me.txtCT1.Text = ""
'
'txtToolValue
'
Me.txtToolValue.Location = New System.Drawing.Point(520, 171)
Me.txtToolValue.Name = "txtToolValue"
Me.txtToolValue.Size = New System.Drawing.Size(144, 20)
Me.txtToolValue.TabIndex = 64
Me.txtToolValue.Text = ""
'
'txtTolerance
'
Me.txtTolerance.Location = New System.Drawing.Point(520, 147)
Me.txtTolerance.Name = "txtTolerance"
Me.txtTolerance.Size = New System.Drawing.Size(144, 20)
Me.txtTolerance.TabIndex = 63
Me.txtTolerance.Text = ""
'
'txtCalibrationFreq
'
Me.txtCalibrationFreq.Loca
Me.txtCalibrationFreq.Name
Me.txtCalibrationFreq.Size
Me.txtCalibrationFreq.TabI
Me.txtCalibrationFreq.Text
'
'txtEntryDate
'
Me.txtEntryDate.Location = New System.Drawing.Point(520, 75)
Me.txtEntryDate.Name = "txtEntryDate"
Me.txtEntryDate.Size = New System.Drawing.Size(144, 20)
Me.txtEntryDate.TabIndex = 61
Me.txtEntryDate.Text = ""
'
'txtEntryPerson
'
Me.txtEntryPerson.Location
Me.txtEntryPerson.Name = "txtEntryPerson"
Me.txtEntryPerson.Size = New System.Drawing.Size(144, 20)
Me.txtEntryPerson.TabIndex
Me.txtEntryPerson.Text = ""
'
'cmbStatus
'
Me.cmbStatus.Font = New System.Drawing.Font("Micro
Me.cmbStatus.Items.AddRang
Me.cmbStatus.Location = New System.Drawing.Point(520, 27)
Me.cmbStatus.Name = "cmbStatus"
Me.cmbStatus.Size = New System.Drawing.Size(176, 21)
Me.cmbStatus.TabIndex = 59
'
'lblToolValue
'
Me.lblToolValue.Font = New System.Drawing.Font("Micro
Me.lblToolValue.Location = New System.Drawing.Point(392, 171)
Me.lblToolValue.Name = "lblToolValue"
Me.lblToolValue.Size = New System.Drawing.Size(120, 16)
Me.lblToolValue.TabIndex = 58
Me.lblToolValue.Text = "Tool Value:"
Me.lblToolValue.TextAlign = System.Drawing.ContentAlig
'
'lblTolerance
'
Me.lblTolerance.Font = New System.Drawing.Font("Micro
Me.lblTolerance.Location = New System.Drawing.Point(392, 147)
Me.lblTolerance.Name = "lblTolerance"
Me.lblTolerance.Size = New System.Drawing.Size(120, 16)
Me.lblTolerance.TabIndex = 57
Me.lblTolerance.Text = "Tolerance:"
Me.lblTolerance.TextAlign = System.Drawing.ContentAlig
'
'lblCalibrationTarget
'
Me.lblCalibrationTarget.Fo
Me.lblCalibrationTarget.Lo
Me.lblCalibrationTarget.Na
Me.lblCalibrationTarget.Si
Me.lblCalibrationTarget.Ta
Me.lblCalibrationTarget.Te
Me.lblCalibrationTarget.Te
'
'lblCalibrationFreq
'
Me.lblCalibrationFreq.Font
Me.lblCalibrationFreq.Loca
Me.lblCalibrationFreq.Name
Me.lblCalibrationFreq.Size
Me.lblCalibrationFreq.TabI
Me.lblCalibrationFreq.Text
Me.lblCalibrationFreq.Text
'
'lblEntryDate
'
Me.lblEntryDate.Font = New System.Drawing.Font("Micro
Me.lblEntryDate.Location = New System.Drawing.Point(392, 75)
Me.lblEntryDate.Name = "lblEntryDate"
Me.lblEntryDate.Size = New System.Drawing.Size(120, 16)
Me.lblEntryDate.TabIndex = 54
Me.lblEntryDate.Text = "Entry Date:"
Me.lblEntryDate.TextAlign = System.Drawing.ContentAlig
'
'lblEntryPerson
'
Me.lblEntryPerson.Font = New System.Drawing.Font("Micro
Me.lblEntryPerson.Location
Me.lblEntryPerson.Name = "lblEntryPerson"
Me.lblEntryPerson.Size = New System.Drawing.Size(120, 16)
Me.lblEntryPerson.TabIndex
Me.lblEntryPerson.Text = "Entry Person:"
Me.lblEntryPerson.TextAlig
'
'lblStatus
'
Me.lblStatus.Font = New System.Drawing.Font("Micro
Me.lblStatus.Location = New System.Drawing.Point(392, 27)
Me.lblStatus.Name = "lblStatus"
Me.lblStatus.Size = New System.Drawing.Size(120, 16)
Me.lblStatus.TabIndex = 52
Me.lblStatus.Text = "Status:"
Me.lblStatus.TextAlign = System.Drawing.ContentAlig
'
'txtPieces
'
Me.txtPieces.Location = New System.Drawing.Point(136, 219)
Me.txtPieces.Name = "txtPieces"
Me.txtPieces.Size = New System.Drawing.Size(48, 20)
Me.txtPieces.TabIndex = 51
Me.txtPieces.Text = ""
'
'txtToolOwner
'
Me.txtToolOwner.Location = New System.Drawing.Point(136, 195)
Me.txtToolOwner.Name = "txtToolOwner"
Me.txtToolOwner.Size = New System.Drawing.Size(168, 20)
Me.txtToolOwner.TabIndex = 50
Me.txtToolOwner.Text = ""
'
'txtLocation
'
Me.txtLocation.Location = New System.Drawing.Point(136, 123)
Me.txtLocation.Name = "txtLocation"
Me.txtLocation.Size = New System.Drawing.Size(168, 20)
Me.txtLocation.TabIndex = 49
Me.txtLocation.Text = ""
'
'txtDescription
'
Me.txtDescription.Location
Me.txtDescription.Name = "txtDescription"
Me.txtDescription.Size = New System.Drawing.Size(168, 20)
Me.txtDescription.TabIndex
Me.txtDescription.Text = ""
'
'txtSerialNumber
'
Me.txtSerialNumber.Locatio
Me.txtSerialNumber.Name = "txtSerialNumber"
Me.txtSerialNumber.Size = New System.Drawing.Size(168, 20)
Me.txtSerialNumber.TabInde
Me.txtSerialNumber.Text = ""
'
'txtToolNumber
'
Me.txtToolNumber.Location = New System.Drawing.Point(136, 51)
Me.txtToolNumber.Name = "txtToolNumber"
Me.txtToolNumber.Size = New System.Drawing.Size(168, 20)
Me.txtToolNumber.TabIndex = 46
Me.txtToolNumber.Text = ""
'
'txtToolID
'
Me.txtToolID.Location = New System.Drawing.Point(136, 27)
Me.txtToolID.Name = "txtToolID"
Me.txtToolID.Size = New System.Drawing.Size(168, 20)
Me.txtToolID.TabIndex = 45
Me.txtToolID.Text = ""
'
'lblPieces
'
Me.lblPieces.Font = New System.Drawing.Font("Micro
Me.lblPieces.Location = New System.Drawing.Point(8, 219)
Me.lblPieces.Name = "lblPieces"
Me.lblPieces.Size = New System.Drawing.Size(120, 16)
Me.lblPieces.TabIndex = 44
Me.lblPieces.Text = "Pieces:"
Me.lblPieces.TextAlign = System.Drawing.ContentAlig
'
'lblToolOwner
'
Me.lblToolOwner.Font = New System.Drawing.Font("Micro
Me.lblToolOwner.Location = New System.Drawing.Point(8, 195)
Me.lblToolOwner.Name = "lblToolOwner"
Me.lblToolOwner.Size = New System.Drawing.Size(120, 16)
Me.lblToolOwner.TabIndex = 43
Me.lblToolOwner.Text = "Tool Owner:"
Me.lblToolOwner.TextAlign = System.Drawing.ContentAlig
'
'lblSameCust
'
Me.lblSameCust.Font = New System.Drawing.Font("Micro
Me.lblSameCust.Location = New System.Drawing.Point(8, 171)
Me.lblSameCust.Name = "lblSameCust"
Me.lblSameCust.Size = New System.Drawing.Size(120, 16)
Me.lblSameCust.TabIndex = 42
Me.lblSameCust.Text = "Same Cust/Owner:"
Me.lblSameCust.TextAlign = System.Drawing.ContentAlig
'
'lblCustomer
'
Me.lblCustomer.Font = New System.Drawing.Font("Micro
Me.lblCustomer.Location = New System.Drawing.Point(8, 147)
Me.lblCustomer.Name = "lblCustomer"
Me.lblCustomer.Size = New System.Drawing.Size(120, 16)
Me.lblCustomer.TabIndex = 41
Me.lblCustomer.Text = "Customer:"
Me.lblCustomer.TextAlign = System.Drawing.ContentAlig
'
'lblLocation
'
Me.lblLocation.Font = New System.Drawing.Font("Micro
Me.lblLocation.Location = New System.Drawing.Point(8, 123)
Me.lblLocation.Name = "lblLocation"
Me.lblLocation.Size = New System.Drawing.Size(120, 16)
Me.lblLocation.TabIndex = 40
Me.lblLocation.Text = "Location:"
Me.lblLocation.TextAlign = System.Drawing.ContentAlig
'
'lblDescription
'
Me.lblDescription.Font = New System.Drawing.Font("Micro
Me.lblDescription.Location
Me.lblDescription.Name = "lblDescription"
Me.lblDescription.Size = New System.Drawing.Size(120, 16)
Me.lblDescription.TabIndex
Me.lblDescription.Text = "Description:"
Me.lblDescription.TextAlig
'
'lblSerialNumber
'
Me.lblSerialNumber.Font = New System.Drawing.Font("Micro
Me.lblSerialNumber.Locatio
Me.lblSerialNumber.Name = "lblSerialNumber"
Me.lblSerialNumber.Size = New System.Drawing.Size(120, 16)
Me.lblSerialNumber.TabInde
Me.lblSerialNumber.Text = "Serial Number:"
Me.lblSerialNumber.TextAli
'
'lblToolNumber
'
Me.lblToolNumber.Font = New System.Drawing.Font("Micro
Me.lblToolNumber.Location = New System.Drawing.Point(8, 51)
Me.lblToolNumber.Name = "lblToolNumber"
Me.lblToolNumber.Size = New System.Drawing.Size(120, 16)
Me.lblToolNumber.TabIndex = 37
Me.lblToolNumber.Text = "Tool Number:"
Me.lblToolNumber.TextAlign
'
'lblToolID
'
Me.lblToolID.Font = New System.Drawing.Font("Micro
Me.lblToolID.Location = New System.Drawing.Point(8, 27)
Me.lblToolID.Name = "lblToolID"
Me.lblToolID.Size = New System.Drawing.Size(120, 16)
Me.lblToolID.TabIndex = 36
Me.lblToolID.Text = "Tool ID:"
Me.lblToolID.TextAlign = System.Drawing.ContentAlig
'
'grdEvent
'
Me.grdEvent.Anchor = (((System.Windows.Forms.An
Or System.Windows.Forms.Ancho
Or System.Windows.Forms.Ancho
Me.grdEvent.DataMember = ""
Me.grdEvent.HeaderForeColo
Me.grdEvent.Location = New System.Drawing.Point(8, 16)
Me.grdEvent.Name = "grdEvent"
Me.grdEvent.ReadOnly = True
Me.grdEvent.Size = New System.Drawing.Size(648, 120)
Me.grdEvent.TabIndex = 72
'
'grpboxComments
'
Me.grpboxComments.Controls
Me.grpboxComments.Font = New System.Drawing.Font("Micro
Me.grpboxComments.Location
Me.grpboxComments.Name = "grpboxComments"
Me.grpboxComments.Size = New System.Drawing.Size(664, 80)
Me.grpboxComments.TabIndex
Me.grpboxComments.TabStop = False
Me.grpboxComments.Text = "Comments:"
'
'rtbComments
'
Me.rtbComments.Location = New System.Drawing.Point(8, 16)
Me.rtbComments.Name = "rtbComments"
Me.rtbComments.Size = New System.Drawing.Size(648, 56)
Me.rtbComments.TabIndex = 0
Me.rtbComments.Text = ""
'
'btnAddEvent
'
Me.btnAddEvent.Font = New System.Drawing.Font("Micro
Me.btnAddEvent.Location = New System.Drawing.Point(88, 336)
Me.btnAddEvent.Name = "btnAddEvent"
Me.btnAddEvent.TabIndex = 74
Me.btnAddEvent.Text = "Add &Event:"
'
'btnRedTag
'
Me.btnRedTag.Font = New System.Drawing.Font("Micro
Me.btnRedTag.Location = New System.Drawing.Point(184, 336)
Me.btnRedTag.Name = "btnRedTag"
Me.btnRedTag.Size = New System.Drawing.Size(96, 23)
Me.btnRedTag.TabIndex = 75
Me.btnRedTag.Text = "Add &Red Tag:"
'
'GroupBox1
'
Me.GroupBox1.Controls.AddR
Me.GroupBox1.Font = New System.Drawing.Font("Micro
Me.GroupBox1.Location = New System.Drawing.Point(16, 368)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(664, 144)
Me.GroupBox1.TabIndex = 76
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Events:"
'
'btnLoad
'
Me.btnLoad.Location = New System.Drawing.Point(560, 568)
Me.btnLoad.Name = "btnLoad"
Me.btnLoad.TabIndex = 77
Me.btnLoad.Text = "Load"
'
'frmToolTracker_EditTool
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(704, 541)
Me.Controls.AddRange(New System.Windows.Forms.Contr
Me.Icon = CType(resources.GetObject(
Me.Name = "frmToolTracker_EditTool"
Me.Text = "Tool Tracker: Edit Tool"
CType(Me.grdEvent, System.ComponentModel.ISup
Me.grpboxComments.ResumeLa
Me.GroupBox1.ResumeLayout(
Me.ResumeLayout(False)
End Sub
#End Region
Public Sub Showdata(ByVal Dr As DataRow)
txtToolID.Text = Dr(0)
txtToolNumber.Text = Dr(1)
End Sub
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
Dim frmStatusMessage As New frmStatus()
If Not didPreviouslyConnect Then
frmStatusMessage.Show("Con
End If
Dim isConnecting As Boolean = True
While isConnecting
Try
Dim ToolTracker_EventsConnecti
' The SqlDataAdapter is used to move data between SQL Server,
' and a DataSet.
Dim ProductAdapter As New SqlDataAdapter( _
"select * from TL_Events", _
ToolTracker_EventsConnecti
' Clear out any old data that has been previously loaded into
' the DataSet
ToolingData.Clear()
' Populate the DataSet with the information from the products
' table. Since a DataSet can hold multiple result sets, it's
' a good idea to "name" the result set when you populate the
' DataSet. In this case, the result set is named "Products".
ProductAdapter.Fill(Toolin
' Bind the DataGrid to the desired table in the DataSet. This
' will cause the product information to display.
grdEvent.DataSource = ToolingData.Tables(TOOLING
'//////////Hide columns in SQL that don't want user to see
Dim TS As New DataGridTableStyle()
TS.MappingName = TOOLING_TABLE_NAME
Dim Col As New DataGridTextBoxColumn()
Col.MappingName = "EventID"
Col.HeaderText = "EventID"
Col.Width = 100
TS.GridColumnStyles.Add(Co
Col = New DataGridTextBoxColumn()
Col.MappingName = "ToolID"
Col.HeaderText = "ToolID"
Col.Width = 100
TS.GridColumnStyles.Add(Co
Col = New DataGridTextBoxColumn()
Col.MappingName = "EntryType"
Col.HeaderText = "EntryType"
Col.Width = 100
TS.GridColumnStyles.Add(Co
Col = New DataGridTextBoxColumn()
Col.MappingName = "EntryPerson"
Col.HeaderText = "EntryPerson"
Col.Width = 100
TS.GridColumnStyles.Add(Co
Col = New DataGridTextBoxColumn()
Col.MappingName = "Comments"
Col.HeaderText = "Comments"
Col.Width = 100
TS.GridColumnStyles.Add(Co
Col = New DataGridTextBoxColumn()
Col.MappingName = "EntryDate"
Col.HeaderText = "EntryDate"
Col.Width = 100
TS.GridColumnStyles.Add(Co
grdEvent.TableStyles.Add(T
'//////////End Hide Columns
' Now that the grid is populated, let the user filter the results.
isConnecting = False
Catch exc As Exception
If connectionString = SQL_CONNECTION_STRING Then
' Couldn't connect to SQL Server. Kill The Connection.
frmStatusMessage.Show("Con
End
End If
End Try
End While
frmStatusMessage.Close()
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Me.Close()
End Sub
Private Sub btnRedTag_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRedTag.Click
' Open the Red Tag Form
Dim frmToolTracker_RedTag As New frmToolTracker_RedTag()
frmToolTracker_RedTag.Show
frmToolTracker_RedTag.Disp
End Sub
End Class
ASKER
RobertRFreeman:
I got a doubleclick feature to work fine on the same form. I need to be able to pass it though, so I wrote up something up. If you can help me, I will just go ahead give you both points.
https://www.experts-exchange.com/questions/21261291/Open-another-form-to-pass-the-value.html
I got a doubleclick feature to work fine on the same form. I need to be able to pass it though, so I wrote up something up. If you can help me, I will just go ahead give you both points.
https://www.experts-exchange.com/questions/21261291/Open-another-form-to-pass-the-value.html
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Very nice tutorial. Thank you much!!
Oh yeah, and for DataGrids go here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbwlkwalkthroughusingdatagridwebcontroltoreadwritedata.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbwlkwalkthroughusingdatagridwebcontroltoreadwritedata.asp
sorry, wrong post.
ASKER
Option Strict On
Imports System.Data.SqlClient
Public Class frmToolTracker_DataGrid
Inherits System.Windows.Forms.Form
Protected ProductData As New DataSet()
Protected Const SQL_CONNECTION_STRING As String = _
"Server=localhost;" & _
"DataBase=Triumph;" & _
"Integrated Security=SSPI"
Protected didPreviouslyConnect As Boolean = False
Protected connectionString As String = SQL_CONNECTION_STRING
' Used to reference the table containing product information in
' ProductData.
Protected Const PRODUCT_TABLE_NAME As String = "TL_Tooling"
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
' So that we only need to set the title of the application once,
' we use the AssemblyInfo class (defined in the AssemblyInfo.vb file)
' to read the AssemblyTitle attribute.
Dim ainfo As New AssemblyInfo()
Me.Text = ainfo.Title
Me.mnuAbout.Text = String.Format("&About {0} ...", ainfo.Title)
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents mnuMain As System.Windows.Forms.MainM
Friend WithEvents mnuFile As System.Windows.Forms.MenuI
Friend WithEvents mnuExit As System.Windows.Forms.MenuI
Friend WithEvents mnuHelp As System.Windows.Forms.MenuI
Friend WithEvents mnuAbout As System.Windows.Forms.MenuI
Friend WithEvents btnFilter As System.Windows.Forms.Butto
Friend WithEvents txtFilter As System.Windows.Forms.TextB
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents btnLoad As System.Windows.Forms.Butto
Friend WithEvents grdToolTracker As System.Windows.Forms.DataG
Friend WithEvents mnuPrint As System.Windows.Forms.MenuI
Friend WithEvents mnuTooling As System.Windows.Forms.MenuI
Friend WithEvents mnuTooling_Edit As System.Windows.Forms.MenuI
Friend WithEvents mnuTooling_Add As System.Windows.Forms.MenuI
<System.Diagnostics.Debugg
Dim resources As System.Resources.ResourceM
Me.mnuMain = New System.Windows.Forms.MainM
Me.mnuFile = New System.Windows.Forms.MenuI
Me.mnuPrint = New System.Windows.Forms.MenuI
Me.mnuExit = New System.Windows.Forms.MenuI
Me.mnuHelp = New System.Windows.Forms.MenuI
Me.mnuAbout = New System.Windows.Forms.MenuI
Me.mnuTooling = New System.Windows.Forms.MenuI
Me.mnuTooling_Edit = New System.Windows.Forms.MenuI
Me.mnuTooling_Add = New System.Windows.Forms.MenuI
Me.btnFilter = New System.Windows.Forms.Butto
Me.txtFilter = New System.Windows.Forms.TextB
Me.Label1 = New System.Windows.Forms.Label
Me.btnLoad = New System.Windows.Forms.Butto
Me.grdToolTracker = New System.Windows.Forms.DataG
CType(Me.grdToolTracker, System.ComponentModel.ISup
Me.SuspendLayout()
'
'mnuMain
'
Me.mnuMain.MenuItems.AddRa
Me.mnuMain.RightToLeft = CType(resources.GetObject(
'
'mnuFile
'
Me.mnuFile.Enabled = CType(resources.GetObject(
Me.mnuFile.Index = 0
Me.mnuFile.MenuItems.AddRa
Me.mnuFile.Shortcut = CType(resources.GetObject(
Me.mnuFile.ShowShortcut = CType(resources.GetObject(
Me.mnuFile.Text = resources.GetString("mnuFi
Me.mnuFile.Visible = CType(resources.GetObject(
'
'mnuPrint
'
Me.mnuPrint.Enabled = CType(resources.GetObject(
Me.mnuPrint.Index = 0
Me.mnuPrint.Shortcut = CType(resources.GetObject(
Me.mnuPrint.ShowShortcut = CType(resources.GetObject(
Me.mnuPrint.Text = resources.GetString("mnuPr
Me.mnuPrint.Visible = CType(resources.GetObject(
'
'mnuExit
'
Me.mnuExit.Enabled = CType(resources.GetObject(
Me.mnuExit.Index = 1
Me.mnuExit.Shortcut = CType(resources.GetObject(
Me.mnuExit.ShowShortcut = CType(resources.GetObject(
Me.mnuExit.Text = resources.GetString("mnuEx
Me.mnuExit.Visible = CType(resources.GetObject(
'
'mnuHelp
'
Me.mnuHelp.Enabled = CType(resources.GetObject(
Me.mnuHelp.Index = 1
Me.mnuHelp.MenuItems.AddRa
Me.mnuHelp.Shortcut = CType(resources.GetObject(
Me.mnuHelp.ShowShortcut = CType(resources.GetObject(
Me.mnuHelp.Text = resources.GetString("mnuHe
Me.mnuHelp.Visible = CType(resources.GetObject(
'
'mnuAbout
'
Me.mnuAbout.Enabled = CType(resources.GetObject(
Me.mnuAbout.Index = 0
Me.mnuAbout.Shortcut = CType(resources.GetObject(
Me.mnuAbout.ShowShortcut = CType(resources.GetObject(
Me.mnuAbout.Text = resources.GetString("mnuAb
Me.mnuAbout.Visible = CType(resources.GetObject(
'
'mnuTooling
'
Me.mnuTooling.Enabled = CType(resources.GetObject(
Me.mnuTooling.Index = 2
Me.mnuTooling.MenuItems.Ad
Me.mnuTooling.Shortcut = CType(resources.GetObject(
Me.mnuTooling.ShowShortcut
Me.mnuTooling.Text = resources.GetString("mnuTo
Me.mnuTooling.Visible = CType(resources.GetObject(
'
'mnuTooling_Edit
'
Me.mnuTooling_Edit.Enabled
Me.mnuTooling_Edit.Index = 0
Me.mnuTooling_Edit.Shortcu
Me.mnuTooling_Edit.ShowSho
Me.mnuTooling_Edit.Text = resources.GetString("mnuTo
Me.mnuTooling_Edit.Visible
'
'mnuTooling_Add
'
Me.mnuTooling_Add.Enabled = CType(resources.GetObject(
Me.mnuTooling_Add.Index = 1
Me.mnuTooling_Add.Shortcut
Me.mnuTooling_Add.ShowShor
Me.mnuTooling_Add.Text = resources.GetString("mnuTo
Me.mnuTooling_Add.Visible = CType(resources.GetObject(
'
'btnFilter
'
Me.btnFilter.AccessibleDes
Me.btnFilter.AccessibleNam
Me.btnFilter.Anchor = CType(resources.GetObject(
Me.btnFilter.BackgroundIma
Me.btnFilter.Dock = CType(resources.GetObject(
Me.btnFilter.Enabled = CType(resources.GetObject(
Me.btnFilter.FlatStyle = CType(resources.GetObject(
Me.btnFilter.Font = CType(resources.GetObject(
Me.btnFilter.Image = CType(resources.GetObject(
Me.btnFilter.ImageAlign = CType(resources.GetObject(
Me.btnFilter.ImageIndex = CType(resources.GetObject(
Me.btnFilter.ImeMode = CType(resources.GetObject(
Me.btnFilter.Location = CType(resources.GetObject(
Me.btnFilter.Name = "btnFilter"
Me.btnFilter.RightToLeft = CType(resources.GetObject(
Me.btnFilter.Size = CType(resources.GetObject(
Me.btnFilter.TabIndex = CType(resources.GetObject(
Me.btnFilter.Text = resources.GetString("btnFi
Me.btnFilter.TextAlign = CType(resources.GetObject(
Me.btnFilter.Visible = CType(resources.GetObject(
'
'txtFilter
'
Me.txtFilter.AccessibleDes
Me.txtFilter.AccessibleNam
Me.txtFilter.Anchor = CType(resources.GetObject(
Me.txtFilter.AutoSize = CType(resources.GetObject(
Me.txtFilter.BackgroundIma
Me.txtFilter.Dock = CType(resources.GetObject(
Me.txtFilter.Enabled = CType(resources.GetObject(
Me.txtFilter.Font = CType(resources.GetObject(
Me.txtFilter.ImeMode = CType(resources.GetObject(
Me.txtFilter.Location = CType(resources.GetObject(
Me.txtFilter.MaxLength = CType(resources.GetObject(
Me.txtFilter.Multiline = CType(resources.GetObject(
Me.txtFilter.Name = "txtFilter"
Me.txtFilter.PasswordChar = CType(resources.GetObject(
Me.txtFilter.RightToLeft = CType(resources.GetObject(
Me.txtFilter.ScrollBars = CType(resources.GetObject(
Me.txtFilter.Size = CType(resources.GetObject(
Me.txtFilter.TabIndex = CType(resources.GetObject(
Me.txtFilter.Text = resources.GetString("txtFi
Me.txtFilter.TextAlign = CType(resources.GetObject(
Me.txtFilter.Visible = CType(resources.GetObject(
Me.txtFilter.WordWrap = CType(resources.GetObject(
'
'Label1
'
Me.Label1.AccessibleDescri
Me.Label1.AccessibleName = CType(resources.GetObject(
Me.Label1.Anchor = CType(resources.GetObject(
Me.Label1.AutoSize = CType(resources.GetObject(
Me.Label1.Dock = CType(resources.GetObject(
Me.Label1.Enabled = CType(resources.GetObject(
Me.Label1.Font = CType(resources.GetObject(
Me.Label1.Image = CType(resources.GetObject(
Me.Label1.ImageAlign = CType(resources.GetObject(
Me.Label1.ImageIndex = CType(resources.GetObject(
Me.Label1.ImeMode = CType(resources.GetObject(
Me.Label1.Location = CType(resources.GetObject(
Me.Label1.Name = "Label1"
Me.Label1.RightToLeft = CType(resources.GetObject(
Me.Label1.Size = CType(resources.GetObject(
Me.Label1.TabIndex = CType(resources.GetObject(
Me.Label1.Text = resources.GetString("Label
Me.Label1.TextAlign = CType(resources.GetObject(
Me.Label1.Visible = CType(resources.GetObject(
'
'btnLoad
'
Me.btnLoad.AccessibleDescr
Me.btnLoad.AccessibleName = CType(resources.GetObject(
Me.btnLoad.Anchor = CType(resources.GetObject(
Me.btnLoad.BackgroundImage
Me.btnLoad.Dock = CType(resources.GetObject(
Me.btnLoad.Enabled = CType(resources.GetObject(
Me.btnLoad.FlatStyle = CType(resources.GetObject(
Me.btnLoad.Font = CType(resources.GetObject(
Me.btnLoad.Image = CType(resources.GetObject(
Me.btnLoad.ImageAlign = CType(resources.GetObject(
Me.btnLoad.ImageIndex = CType(resources.GetObject(
Me.btnLoad.ImeMode = CType(resources.GetObject(
Me.btnLoad.Location = CType(resources.GetObject(
Me.btnLoad.Name = "btnLoad"
Me.btnLoad.RightToLeft = CType(resources.GetObject(
Me.btnLoad.Size = CType(resources.GetObject(
Me.btnLoad.TabIndex = CType(resources.GetObject(
Me.btnLoad.Text = resources.GetString("btnLo
Me.btnLoad.TextAlign = CType(resources.GetObject(
Me.btnLoad.Visible = CType(resources.GetObject(
'
'grdToolTracker
'
Me.grdToolTracker.Accessib
Me.grdToolTracker.Accessib
Me.grdToolTracker.Anchor = CType(resources.GetObject(
Me.grdToolTracker.Backgrou
Me.grdToolTracker.CaptionF
Me.grdToolTracker.CaptionT
Me.grdToolTracker.DataMemb
Me.grdToolTracker.Dock = CType(resources.GetObject(
Me.grdToolTracker.Enabled = CType(resources.GetObject(
Me.grdToolTracker.Font = CType(resources.GetObject(
Me.grdToolTracker.HeaderFo
Me.grdToolTracker.ImeMode = CType(resources.GetObject(
Me.grdToolTracker.Location
Me.grdToolTracker.Name = "grdToolTracker"
Me.grdToolTracker.ReadOnly
Me.grdToolTracker.RightToL
Me.grdToolTracker.Size = CType(resources.GetObject(
Me.grdToolTracker.TabIndex
Me.grdToolTracker.Visible = CType(resources.GetObject(
'
'frmToolTracker_DataGrid
'
Me.AccessibleDescription = CType(resources.GetObject(
Me.AccessibleName = CType(resources.GetObject(
Me.Anchor = CType(resources.GetObject(
Me.AutoScaleBaseSize = CType(resources.GetObject(
Me.AutoScroll = CType(resources.GetObject(
Me.AutoScrollMargin = CType(resources.GetObject(
Me.AutoScrollMinSize = CType(resources.GetObject(
Me.BackgroundImage = CType(resources.GetObject(
Me.ClientSize = CType(resources.GetObject(
Me.Controls.AddRange(New System.Windows.Forms.Contr
Me.Dock = CType(resources.GetObject(
Me.Enabled = CType(resources.GetObject(
Me.Font = CType(resources.GetObject(
Me.Icon = CType(resources.GetObject(
Me.ImeMode = CType(resources.GetObject(
Me.Location = CType(resources.GetObject(
Me.MaximumSize = CType(resources.GetObject(
Me.Menu = Me.mnuMain
Me.MinimumSize = CType(resources.GetObject(
Me.Name = "frmToolTracker_DataGrid"
Me.RightToLeft = CType(resources.GetObject(
Me.StartPosition = CType(resources.GetObject(
Me.Text = resources.GetString("$this
Me.Visible = CType(resources.GetObject(
Me.WindowState = System.Windows.Forms.FormW
CType(Me.grdToolTracker, System.ComponentModel.ISup
Me.ResumeLayout(False)
End Sub
#End Region
#Region " Standard Menu Code "
' <System.Diagnostics.Debugg
' not the focus of the demo. Remove them if you wish to debug the procedures.
' This code simply shows the About form.
<System.Diagnostics.Debugg
' Open the About form in Dialog Mode
Dim frm As New frmAbout()
frm.ShowDialog(Me)
frm.Dispose()
End Sub
<System.Diagnostics.Debugg
' Open the Crystal Report form in Dialog Mode
Dim frmCrystal As New frmToolTracker_Crystal()
frmCrystal.ShowDialog(Me)
frmCrystal.Dispose()
End Sub
<System.Diagnostics.Debugg
' Open the Add Tooling Form
Dim frmToolTracker_AddTool As New frmToolTracker_AddTool()
frmToolTracker_AddTool.Sho
frmToolTracker_AddTool.Dis
End Sub
<System.Diagnostics.Debugg
' Open the Edit Tooling Form
Dim frmToolTracker_EditTool As New frmToolTracker_EditTool()
frmToolTracker_EditTool.Sh
frmToolTracker_EditTool.Di
End Sub
' This code will close the form.
<System.Diagnostics.Debugg
' Close the current form
Me.Close()
End Sub
#End Region
Private Sub btnFilter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFilter.Click
Const MESSAGEBOX_CAPTION As String = "Filter"
' Sanity check
Debug.Assert(Not ProductData.Tables(PRODUCT
"No product data loaded in ProductData.Tables(PRODUCT
With ProductData.Tables(PRODUCT
' Filter the view so that only product names starting with a
' specified string are available.
.DefaultView.RowFilter = "Tool like '" & txtFilter.Text & "%'"
' Are there any matching products?
If .DefaultView.Count = 0 Then
MessageBox.Show("No matching rows.", _
MESSAGEBOX_CAPTION, _
MessageBoxButtons.OK, _
MessageBoxIcon.Information
End If
' By binding the grid to the DataView, the grid will now display
' only the matching rows.
grdToolTracker.DataSource = .DefaultView
End With
End Sub
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
Dim frmStatusMessage As New frmStatus()
If Not didPreviouslyConnect Then
frmStatusMessage.Show("Con
End If
Dim isConnecting As Boolean = True
While isConnecting
Try
Dim northwindConnection As New SqlConnection(connectionSt
' The SqlDataAdapter is used to move data between SQL Server,
' and a DataSet.
Dim ProductAdapter As New SqlDataAdapter( _
"select * from TL_Tooling", _
northwindConnection)
' Clear out any old data that has been previously loaded into
' the DataSet
ProductData.Clear()
' Populate the DataSet with the information from the products
' table. Since a DataSet can hold multiple result sets, it's
' a good idea to "name" the result set when you populate the
' DataSet. In this case, the result set is named "Products".
ProductAdapter.Fill(Produc
' Bind the DataGrid to the desired table in the DataSet. This
' will cause the product information to display.
grdToolTracker.DataSource = ProductData.Tables(PRODUCT
'//////////Hide columns in SQL that don't want user to see
Dim TS As New DataGridTableStyle()
TS.MappingName = PRODUCT_TABLE_NAME
Dim Col As New DataGridTextBoxColumn()
Col.MappingName = "ID"
Col.HeaderText = "ID"
Col.Width = 100
TS.GridColumnStyles.Add(Co
'Repaet these set of lines for all columns we want to see
Col = New DataGridTextBoxColumn()
Col.MappingName = "ToolID"
Col.HeaderText = "ToolID"
Col.Width = 100
TS.GridColumnStyles.Add(Co
Col = New DataGridTextBoxColumn()
Col.MappingName = "ToolNumber"
Col.HeaderText = "ToolNumber"
Col.Width = 100
TS.GridColumnStyles.Add(Co
Col = New DataGridTextBoxColumn()
Col.MappingName = "Description"
Col.HeaderText = "Description"
Col.Width = 100
TS.GridColumnStyles.Add(Co
Col = New DataGridTextBoxColumn()
Col.MappingName = "SerialNumber"
Col.HeaderText = "SerialNumber"
Col.Width = 100
TS.GridColumnStyles.Add(Co
Col = New DataGridTextBoxColumn()
Col.MappingName = "Location"
Col.HeaderText = "Location"
Col.Width = 100
TS.GridColumnStyles.Add(Co
Col = New DataGridTextBoxColumn()
Col.MappingName = "StatusCode"
Col.HeaderText = "StatusCode"
Col.Width = 150
TS.GridColumnStyles.Add(Co
'Col = New DataGridTextBoxColumn()
'Col.MappingName = "SALARY"
'Col.Width = 0
'TS.GridColumnStyles.Add(C
grdToolTracker.TableStyles
'//////////End Hide Columns
' Now that the grid is populated, let the user filter the results.
btnFilter.Enabled = True
isConnecting = False
Catch exc As Exception
If connectionString = SQL_CONNECTION_STRING Then
' Couldn't connect to SQL Server. Kill The Connection.
frmStatusMessage.Show("Con
End
End If
End Try
End While
frmStatusMessage.Close()
End Sub
End Class