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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pl. help

Status
Not open for further replies.

SIDSHU

Programmer
Nov 7, 2002
9
0
0
US
In VB.net I am selecting multiple rows from tables and then need to put check mark along each row so that I can update only those which has checked.

ex.. Name requested qty shipped qty are fields in table
what ever is checked( check sign) i.e A and C their shipped qty should be update once UPDATE buton is clicked.

Checkmark box Name requested qty shipped qty
---------------------------------------------------
checked A 10 9
not checked B 6
checked C 3 3
------------------------------------------

UPDate_Button

I hope it explains. Please let me know.
Thank you
 
There is a separate VB.Net forum that might be more likely to be of help - though I suspect a bit more detail will be required - is this data going into a grid for example.
 
Thanks Glasgow.


I am populating the datagrid by sql script.
How can I add check box for each row? The data is getting direct from table after running sql-script.
Thanks.
 
Is this SQL Server? If so, you could experiment with changing your SELECT statement from e.g.

'SELECT * FROM TABLE'

to
'SELECT *,
CheckBox=CASE WHEN <condition> THEN 1 ELSE 0 END'

which will return an additional field that is either 1 or 0. Change the format of this column in the grid to Checkbox.
 

It is from db2 and I am filling the dataset.
The select statement is

select Name requested qty shipped qty from table1

 
If Db2 I'm not sure, sorry.

Do all rows start off unchecked - in which case the CASE statement is not required and you could try something like:

select CheckBox=0 Name requested qty shipped qty from table1

or whatever syntax is required to generate a dummy field in the first column. Perhaps even

select 0 Name requested qty shipped qty from table1
 
select 0 Name requested qty shipped qty from table1 did work but that column becomes as Expression1.

Expression1 Name requested qty shipped qty
0 A 10 9

Expresssion1 is only for form. i can not update based on this field.
Thanks
 
Is the purpose of this CheckBox to allow the user to tick rows that are to be updated? If so, and the data is being used to populate a DataGrid, then you can, at design time, change the format of the first DataGrid column to be a CheckBox. As all values will be returned initially as zero, I would expect the checkboxes to be blank. When the user ticks any of the checkbox the value of Expression1 to become 1 - so you can then update all those rows whose first column is set to 1.

It might help to see some code.
 
I am new to this VBnet.So pl. explain.

This populate the data but I can not do any check as thete is no check mark box. I can not add it or I do not know How??

The first 0 in selected field does not belong to any table.

The code is like this...
***********************************
Private Sub InitializeComponent()
Me.CUST = New System.Windows.Forms.DataGrid
Me.OledbSelectCommand1 = New System.Data.OleDb.OleDbCommand
Me.OledbConnection1 = New System.Data.OleDb.OleDbConnection
Me.OledbDataAdapter1 = New System.Data.OleDb.OleDbDataAdapter
Me.DataSet1 = New System.Data.DataSet
CType(Me.CUST, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DataSet1, System.ComponentModel.ISupportInitialize).BeginInit()
'
'CUST
'
Me.CUST.DataMember = &quot;&quot;
Me.CUST.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.CUST.Location = New System.Drawing.Point(63, 25)
Me.CUST.Name = &quot;CUST&quot;
Me.CUST.PreferredColumnWidth = 97
Me.CUST.Size = New System.Drawing.Size(630, 200)
Me.CUST.TabIndex = 0
'
'OledbSelectCommand1
'
Me.OledbSelectCommand1.CommandText = &quot;SELECT 0 , A.Name ,B.ReqQty ,B.Shipped_qty FROM CUST A, Dept B WHERE A.CUSTID=B.CUSTID)&quot;
Me.OledbSelectCommand1.Connection = Me.OledbConnection1
'
'OledbConnection1
'
Me.OledbConnection1.ConnectionString = &quot;Provider=DB2.1;user id='';password='';data source=test; &quot;
'
'OledbDataAdapter1
'
Me.OledbDataAdapter1.SelectCommand = Me.OledbSelectCommand1
'DataSet1
'
Me.DataSet1.DataSetName = &quot;New DataSet&quot;
Me.DataSet1.Locale = New System.Globalization.CultureInfo(&quot;en-US&quot;)
'
'FrmTableDisplay
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
Me.ClientSize = New System.Drawing.Size(853, 480)
Me.Name = &quot;FrmTableDisplay&quot;
Me.Text = &quot; Table Display&quot;
CType(Me.CUST, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DataSet1, System.ComponentModel.ISupportInitialize).EndInit()

End Sub 'InitializeComponents
 
This thread is off-topic in VB5/6 forum - please read faq222-2244 then post in the appropriate forum!

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top