I am trying to create a rightclick event on the textbox of the first column of a grid. I have the grid already on the form and when the user enters a value in a textbox and presses enter, I use the following code to get the data and then add it to the grid.
If I add the right click event to the textbox of the grid it seeems to work only for the first data set. Every other try, without unloading the form does not have a rightclick event. Seems like I need to add the rightclick event when I setup the grid but don't know how.
*** Get Data
SQLSelect = "SELECT SerialNumber, "+;
"CalDate, "+;
"CalibrationGas, "+;
"TechName, "+;
"ID "+;
"FROM LeakSTD "+;
"WHERE SONumber = " + ALLTRIM(thisform.txtSono.Value) + " "+;
"ORDER BY SerialNumber"
= SQLEXEC(lnConn, SQLSelect, 'LS_data')
*** Setup Grid
WITH thisform.grid1
.ColumnCount = 5
.DeleteMark = .F.
.RecordSource = 'LS_Data'
.width = 550
.Column1.ControlSource = 'LS_Data.SerialNumber'
.Column1.Width = 85
.Column1.Name = "Column1"
.Column1.Header1.caption = "Serial #"
.Column2.ControlSource = 'LS_Data.Model'
.Column2.Width = 200
.Column2.Name = "Column2"
.Column2.Header1.caption = "Model"
.Column3.ControlSource = 'LS_Data.CalDate'
.Column3.Width = 85
.Column3.Name = "Column3"
.Column3.Header1.caption = "Cal Date"
.Column4.ControlSource = 'LS_Data.CalibrationGas'
.Column4.Width = 85
.Column4.Name = "Column4"
.Column4.Header1.caption = "Cal Gas"
.Column5.ControlSource = 'LS_Data.TechName'
.Column5.Width = 85
.Column5.Name = "Column5"
.Column5.Header1.caption = "Tech"
.scrollbars = 2
.Visible = .T.
ENDWITH
Ed
If I add the right click event to the textbox of the grid it seeems to work only for the first data set. Every other try, without unloading the form does not have a rightclick event. Seems like I need to add the rightclick event when I setup the grid but don't know how.
*** Get Data
SQLSelect = "SELECT SerialNumber, "+;
"CalDate, "+;
"CalibrationGas, "+;
"TechName, "+;
"ID "+;
"FROM LeakSTD "+;
"WHERE SONumber = " + ALLTRIM(thisform.txtSono.Value) + " "+;
"ORDER BY SerialNumber"
= SQLEXEC(lnConn, SQLSelect, 'LS_data')
*** Setup Grid
WITH thisform.grid1
.ColumnCount = 5
.DeleteMark = .F.
.RecordSource = 'LS_Data'
.width = 550
.Column1.ControlSource = 'LS_Data.SerialNumber'
.Column1.Width = 85
.Column1.Name = "Column1"
.Column1.Header1.caption = "Serial #"
.Column2.ControlSource = 'LS_Data.Model'
.Column2.Width = 200
.Column2.Name = "Column2"
.Column2.Header1.caption = "Model"
.Column3.ControlSource = 'LS_Data.CalDate'
.Column3.Width = 85
.Column3.Name = "Column3"
.Column3.Header1.caption = "Cal Date"
.Column4.ControlSource = 'LS_Data.CalibrationGas'
.Column4.Width = 85
.Column4.Name = "Column4"
.Column4.Header1.caption = "Cal Gas"
.Column5.ControlSource = 'LS_Data.TechName'
.Column5.Width = 85
.Column5.Name = "Column5"
.Column5.Header1.caption = "Tech"
.scrollbars = 2
.Visible = .T.
ENDWITH
Ed