create multiple Check Boxes at run time



I have not been able to get this to work. I have (in a test setup) 8 items in the MSFlexGrid filled
from a database. The first column has an identity number which I am attempting to display at each
Check Box. I want to provide the user with the option to delete those rows that the user selects
using the check box. The code below produces the last check box only. How do I get it to display
all 8 (or more depending upon the database)? What am I doing wrong? The code is producing one
check box as it goes through the For...Next and not creating 8 check boxes. Is there a better way
to remove selected rows from the grid and db?

Thank you,
Jim Y


' create CheckBox at run time - Maximum of 70 to display
Dim CheckBox As CheckBox
Dim ChkBox(1 To 70) As CheckBox
Dim iCBtop As Integer 'ChkBox top
Dim iCBleft As Integer 'ChkBox left

iCBtop = 4560
iCBleft = 720
iIndex = (Me.MSFlexGrid1.Rows - 1)

Set CheckBox = FrmMain.Controls.Add("VB.CheckBox", "NewCheckBox")

For iIndex = 1 To (Me.MSFlexGrid1.Rows - 1)
'Create Control Array of multiple check boxes for displayed items
' test with 8 displayed items - modify for 70 or more items
Set ChkBox(iIndex) = CheckBox
With ChkBox(iIndex)
.Visible = True
.Height = 255
.Width = 975
.Top = iCBtop '4560 to start
.Left = iCBleft '720 first column
.Caption = FrmMain.MSFlexGrid1.TextMatrix(iIndex, 1)
End With
iCBtop = iCBtop + 360
Next iIndex



.



Relevant Pages

  • Trouble Using DataAdapter.Update()
    ... data is massaged and mingled with data in the destination table. ... all I have left to do is update the database table ... Dim TextConn As New System.Data.OleDb.OleDbConnection ... ' Verify that the data is corect by binding to a gridview for visual display ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Problems with checkbox value stored in database
    ... The CODE for database entry is as follows: ... 'recRS stands for recordset corresponding to the recordcount of the current ... Dim l_CurrentLocalShareOutlay ... 'The following variable is being added in order to add the value of checkbox ...
    (microsoft.public.inetserver.asp.general)
  • Re: How do I get a list from an excel sheet into a userform/listbox?
    ... I am planning to have a excel sheet that can display information based ... on a list located in another sheet (a database of sorts). ... Dim ws As Worksheet ...
    (microsoft.public.excel.programming)
  • Re: checkbox on gridview
    ... Protected Sub GridView1_RowDataBound(ByVal sender As Object, ... Dim MyConnection As OdbcConnection ... MyConnection.Open'open connection to database ... is passed to the function and you can use this to check if the checkbox is ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Hashtable to Data List?
    ... It looks as if what you want to display is not the contents of the ... but the records you can get back by querying the database ... The HashTable simply stores The ITEMID, ... > Dim objConn as new ...
    (microsoft.public.dotnet.framework.aspnet)