iFocus.Life News News - Breaking News & Top Stories - Latest World, US & Local News,Get the latest news, exclusives, sport, celebrities, showbiz, politics, business and lifestyle from The iFocus.Life,

How to Place a Combo in DataGrid in VB6

104 123
  • 1). Create a new Standard EXE Visual Basic project. From the menu, select "Project," "Components." Click the check box next to "Microsoft DataGrid Control 6.0 (OLE)." Click on the "OK" button to save and close. From the menu, select "Project," "References." Click the check box next to "Microsoft ActiveX DataObjects 2.x Library," where "x" is the highest number available. Click the "OK" button to save and close.

  • 2). Add a new DataGrid control to the "Form1" that was created by default. The default name will be "DataGrid1." Configure the data source and other properties of the "DataGrid1" control so that the correct information is being displayed.

  • 3). Add a Combo box control to "Form1" and set its visible property to "False." Get the top position, row height and column width of the cell on "DataGrid1" that you want to display the Combo box on and store each of those values into separate integer variables.

  • 4). Set the position values for the hidden Combo box to those of the cell the user clicked on in "DataGrid1" and set the Combo box visible property to "True." This will position the Combo box directly on top of the cell on "DataGrid1" and the user will see a drop-down list of values to select from.

  • 5). Code the click event of the Combo box so that when the user makes a selection, we update the contents of the cell on "DataGrid1" with the new value selected from the Combo box:

    If cmbMyCombo.Visible = True Then

    DataGrid1.Columns(2).Text = cmbMyCombo.Text

    End If

Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time
You might also like on "Technology"

Leave A Reply

Your email address will not be published.