?
Solved

datagrid control 6.0

Posted on 2001-06-26
7
Medium Priority
?
185 Views
Last Modified: 2010-05-02
Hi
 Can someone please help me out with this problem.
It is like this.
I am using ado data control to link a datagrid control to a ms access database table.
How can I do it by only using code and not ado data control. It should be like this
1) In the beginning it should be blank to allow the user to input data
2) Then the user can click on a command button to save data to the table in the database
3)Then the user can use one of the fields(maybe primary key) to retrieve the data and display it on the datagrid.
But it should be by using only code not ado data control

thanks

0
Comment
Question by:bimalprakashsharma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Expert Comment

by:TomLaw1999
ID: 6228993
The bast way to learn database programming is by example and Microsoft has provided a data programming generator in VB6 that explains what to do.

1) Click on add-ins
2) Select add-in manager
3) Select VB6 data form wizard.

A coded ADO program complete with data control can be generated very quickly and easily.

p.s. Just in case the add-in is not available on your version the code you require is available from the microsoft site www.microsoft.com and there are a number of excellent examples on www.planetsourcecode.com.

Best of luck with your project.
0
 

Expert Comment

by:bppraveen001
ID: 6230924
Hello bimalprakashsharma,

1) Add DataGrid component to your project (by using Project -> Components) and add it to the form where you want(also add other components that you want for the form).
2) Take reference to Microsoft ActiveX Data Objects 2.5 (ADO 2.5) to the project.
3) After the user entered the details and when he clicks on the Submit button take the connection to Database and store the information in the table (by using either ADODB.Command or ADODB.Recordset object or if you have any stored procedure which does the work of storing the values into database(table) ) after that execute one select state like :
  Select Field from table
and execute the statement. If there are any recrods in the table  ADODB.Recordset object will contain the result set then you issue the following command :
  Set DataGrid1.DataSource=objRecordSet
  DataGrid1.Refresh
This will store the resultset values.

After this you write the code in on click of the DataGrid and findout on which row user has clicked then take the value of the corresponding row and do the remaining task that you want to do.

bpp
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6231460
bppraveen001, you are not new to this site so should be familiar with the protocol. It is not good practice to lock questions in this way by using the "answer" option. Please read the guidelines on comments vs answers at the bottom of this page.

bimalprakashsharma: Please close out the ungraded thread http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20085950 you are still active on this site and a failure to maintain your questions is sufficient grounds for suspension of your account.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:bimalprakashsharma
ID: 6232826
I cannot enter anything into the datagrid control unless I bind it to ADO data control. Even if I set the allow add new to true..............
0
 
LVL 4

Accepted Solution

by:
TomLaw1999 earned 600 total points
ID: 6232950
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6710106
Please update and finalize ALL your open questions at this site.  Site Guidelines and Member Agreement as well as details on the Question/Answer process are available from the HELP DESK link on the left.

Moondancer
Community Support Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6724216
bimalprakashsharma ----->  You last logged on 01/07/02, and have open questions you have not updated/finalized, some of which date back to early last year.

PLEASE UPDATE ALL YOUR OPEN QUESTIONS and add comments if more is needed, and award the experts who have helped you to close them.

If you need help in splitting points or for other actions, please comment and I will respond as quickly as I can.

I am adding this to all your open questions to make it easier for you to find them and update them.

Thank you,

Moondancer
Community Support Moderator @ Experts Exchange
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question