DIGIT-ARC read-only archive · snapshot: July 23, 2026

VB 6 Help Needed

3 posts · originally from https://geek.digit.in/community/threads/vb-6-help-needed.96576/

P
part_time_ch Original post #1
Aug 28, 2008 at 11:25 AM
I am using VB6 with Access for a data entry project.

i have an idea to use MSflexgrid to display the data whenever i save it in the database.

i mean i have a form with four fields and adding and updating the new datas to the database.

i need to display the data automatically in the flexgrid whenever i am clicking the save button.

also the existing datas in the database should appear in the ms flexgrid tool.

please tell me the code to display the records in msflexgrid automatically when i save it to the database.
P
Aug 30, 2008 at 5:17 PM
it is not bind data with msflexgrid , so you have to rebind data again.
J
javed4shab #3
Aug 31, 2008 at 4:49 PM
Boss,

You should use a component named :
"Microsoft ADO Data Control 6.0"
This control works best for Data Grid Flex.
1. DRAW ADO CONTROL.
2. RIGHT CLICK on ADO CONTROL.
3. Set Properties.
4. Now Click on Data Grid set it's Datasource property to "adodc1".
5. The Problem will be solved.

If you wish to connect through ADO Code then use :

down load reference " Microsoft Activex Dataobjects 2.0 Library"
Now type following code:

Dim con as new adodb.connection
dim rs as new adodb.recordset
Private sub form_load()
set con = new adodb.connection
with con
.connectionstring = "provider= Microsoft jet 2.0; filename= " 'enter file name
.connectiontimeout = 5
.cursor location = aduseclient
.open
end with
end sub
private sub cmdsave_click() 'cmdsave is name of save command button
rs.open "select * from emp", con, adopendynamic, lockoptimistic, adcmdtext
rs!empno = text1.text 'empno is database field
rs!absg = text2.text
rs.update
set datagrid1.datasource = rs.datasource ' where rs is recordset that you've create.
'and datagrid1 i name of data grid.
end sub
This will Solve your Problem. Enjoy ;-)


JAVED KHAN
IT EXECUTIVE
javed4shab@gmail.com