473,326 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Data Grid problem

123 100+
Hi,

I am using vb. I have data grid on my form. At runtime i am not able to enter data into data grid. I think grid is locked. Do i need to set any property or need to write code to enter as many records as i want at runtime?

I am using DataGrid. Is it ok or i should use DBGrid. My back end is access.
Please help me soon. It is quite urgent.
Mar 21 '07 #1
20 4728
vijaydiwakar
579 512MB
Hi,

I am using vb. I have data grid on my form. At runtime i am not able to enter data into data grid. I think grid is locked. Do i need to set any property or need to write code to enter as many records as i want at runtime?

I am using DataGrid. Is it ok or i should use DBGrid. My back end is access.
Please help me soon. It is quite urgent.
y dont' u go for Componants VsFlexGrid
Mar 21 '07 #2
ansumansahu
149 100+
Hi,

I am using vb. I have data grid on my form. At runtime i am not able to enter data into data grid. I think grid is locked. Do i need to set any property or need to write code to enter as many records as i want at runtime?

I am using DataGrid. Is it ok or i should use DBGrid. My back end is access.
Please help me soon. It is quite urgent.
Hi ,

Refer to this link

http://msdn2.microsoft.com/en-us/library/y4ddh1ac(vs.80).aspx

it might help you solve your problem.

thanks
ansuman sahu
Mar 21 '07 #3
cmrhema
375 256MB
The link by ansuman will help you if you are using visual studio 2005
The below is the exact link for it (i presume)
Please do read the tutorial carefully
http://msdn.microsoft.com/library/de...ridControl.asp

First check out the allowaddnew property set it to true
Thereafter if you are using a adodc control then set the relevant properties.
After setting the properties of adodc control right click on the datagrid and choose retrieve fields.

In case you are going to code then set the recordset to the datagrid
here's an example
Here Myrs2 is the record set
'Set on the cursor location
MyRs2.CursorLocation = adUseClient
MyRs2.Open "select * from investmentdetails ", MyCon, adOpenDynamic, adLockOptimistic
'Set the datasource to the record set
Set DataGrid1.DataSource = MyRs2

NEXT TIME ONWARDS PLEASE PUT ON YOUR CODE

Good luck
Mar 21 '07 #4
Shailja
123 100+
The link by ansuman will help you if you are using visual studio 2005
The below is the exact link for it (i presume)
Please do read the tutorial carefully
http://msdn.microsoft.com/library/de...ridControl.asp

First check out the allowaddnew property set it to true
Thereafter if you are using a adodc control then set the relevant properties.
After setting the properties of adodc control right click on the datagrid and choose retrieve fields.

In case you are going to code then set the recordset to the datagrid
here's an example
Here Myrs2 is the record set
'Set on the cursor location
MyRs2.CursorLocation = adUseClient
MyRs2.Open "select * from investmentdetails ", MyCon, adOpenDynamic, adLockOptimistic
'Set the datasource to the record set
Set DataGrid1.DataSource = MyRs2

NEXT TIME ONWARDS PLEASE PUT ON YOUR CODE

Good luck
I dont want to display records from a perticular table. I want to enter records by my own into Data Grid at runtime. So what is the solution for that?
Mar 21 '07 #5
cmrhema
375 256MB
I dont want to display records from a perticular table. I want to enter records by my own into Data Grid at runtime. So what is the solution for that?
DID U TRY OUT THE CODE

'Set on the cursor location
MyRs2.CursorLocation = adUseClient
MyRs2.Open "select * from investmentdetails ", MyCon, adOpenDynamic, adLockOptimistic
'Set the datasource to the record set
Set DataGrid1.DataSource = MyRs2
NOW YOU WILL BE ABLE TO ENTER DATA.
Make sure to set AllowAddNew and AllowUpdate to true
No need any more code it will automatically add the records In case you want to delete set AllowDelete to true
Mar 21 '07 #6
Shailja
123 100+
DID U TRY OUT THE CODE

'Set on the cursor location
MyRs2.CursorLocation = adUseClient
MyRs2.Open "select * from investmentdetails ", MyCon, adOpenDynamic, adLockOptimistic
'Set the datasource to the record set
Set DataGrid1.DataSource = MyRs2
NOW YOU WILL BE ABLE TO ENTER DATA.
Make sure to set AllowAddNew and AllowUpdate to true
No need any more code it will automatically add the records In case you want to delete set AllowDelete to true

No, Still i am not able to enter new record in data grid. You dont understand my question. I dont want to display records of perticular table in grid. I want to add records in grid at runtime. Grid will be blank at runtime and i want to enter data in it. Neither cursor is coming in first column and first row nor i m able to enter the record
Mar 22 '07 #7
coolminded
137 100+
you can better use the component 'VSFlex' to write at the run time
Mar 22 '07 #8
Shailja
123 100+
you can better use the component 'VSFlex' to write at the run time
I dont understand ur reply. you have asked me to use FlexGrid? But in MSFlex Grid i wont be able to edit cell, right?

How to enter data in that at runtime? Plz let me know
Mar 22 '07 #9
vijaydiwakar
579 512MB
I dont understand ur reply. you have asked me to use FlexGrid? But in MSFlex Grid i wont be able to edit cell, right?

How to enter data in that at runtime? Plz let me know
Shailja ,
MSFlexgrid is not editable.
That's y i had suggested u to use Componant One's VsFlexGrid
Try It
Good Luck
Mar 22 '07 #10
Shailja
123 100+
Shailja ,
MSFlexgrid is not editable.
That's y i had suggested u to use Componant One's VsFlexGrid
Try It
Good Luck
Thanks for the reply.Can u tell me how to add that component? I have never used it. How to add it and what code should i write to enter data at runtime?
Mar 23 '07 #11
vijaydiwakar
579 512MB
Thanks for the reply.Can u tell me how to add that component? I have never used it. How to add it and what code should i write to enter data at runtime?
See this is the third part componant.
So u have to manage it by urself.
for run time editing no need to code any more its by default editable i.e. u've to set its editable property =0 or 1 or 2 or 3
try it Good Luck
Mar 23 '07 #12
cmrhema
375 256MB
See this is the third part componant.
So u have to manage it by urself.
for run time editing no need to code any more its by default editable i.e. u've to set its editable property =0 or 1 or 2 or 3
try it Good Luck
Shailja
Kindly let me know one thing. Are u connecting datagrid with ADODC control or are you using ADODB.
In case you are using ADODB I am at complete loss to understand why and where did my code fail in entering data.
I not only completed my project using that code. But got installed at the client's place with much success.
Mar 23 '07 #13
Shailja
123 100+
See this is the third part componant.
So u have to manage it by urself.
for run time editing no need to code any more its by default editable i.e. u've to set its editable property =0 or 1 or 2 or 3
try it Good Luck

How do i get the component? From which site, i will get that component? Can u suggest me site? Bcoz VB does not provide that component.
Mar 27 '07 #14
Shailja
123 100+
Shailja
Kindly let me know one thing. Are u connecting datagrid with ADODC control or are you using ADODB.
In case you are using ADODB I am at complete loss to understand why and where did my code fail in entering data.
I not only completed my project using that code. But got installed at the client's place with much success.
I am using ADODB. Why I need to connect datagrid as i dont want to display records from perticular table. I want to enter by my own. Is it possible with datagrid or not?
Mar 27 '07 #15
Shailja
123 100+
See this is the third part componant.
So u have to manage it by urself.
for run time editing no need to code any more its by default editable i.e. u've to set its editable property =0 or 1 or 2 or 3
try it Good Luck

How do i get the component? From which site, i will get that component? Can u suggest me site? Bcoz VB does not provide that component. Please tell me site name from where i get that component
Mar 28 '07 #16
better can be:

Build the disconnected recordset with the column names of datagrid as its fields
and assign it as datasource.


while saving it to database use this recordsets value:

Suppose you want columns like
First Name Last Name Address

Expand|Select|Wrap|Line Numbers
  1.     with rs.fields
  2.          .append "[First Name]",adBSTR
  3.          .append "[Last Name]",adBSTR
  4.          .append "[Address]",adBSTR
  5.     end with
  6.  
  7.     rs.open
  8.  
  9.     set dtgrid.datasource=rs
  10.  
Mar 28 '07 #17
Shailja
123 100+
better can be:

Build the disconnected recordset with the column names of datagrid as its fields
and assign it as datasource.


while saving it to database use this recordsets value:

Suppose you want columns like
First Name Last Name Address

Expand|Select|Wrap|Line Numbers
  1.     with rs.fields
  2.          .append "[First Name]",adBSTR
  3.          .append "[Last Name]",adBSTR
  4.          .append "[Address]",adBSTR
  5.     end with
  6.  
  7.     rs.open
  8.  
  9.     set dtgrid.datasource=rs
  10.  
I dont understand your reply. Can you give me complete code for disconnected datasource. How to make FlexGrid to VSFlexGrid?
Mar 28 '07 #18
your prime requirement was data entry in Datagrid.

This technique is suitable for you.
Mar 28 '07 #19
Shailja
123 100+
your prime requirement was data entry in Datagrid.

This technique is suitable for you.

I dont understand your code, you have given before. Please give me complete code. On which event, i should write this code. The code you have given for what, for Data Grid or for VSFlex Grid. Please let me know
Mar 28 '07 #20
write this code on form load and it is for Datagrid control.
Mar 28 '07 #21

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jordan O'Hare | last post by:
Hello Everyone, I am after some help with the following: I have a windows application that contains a list box and two data grids. All three controls are binded to a dataset that contains...
2
by: kk | last post by:
Have 2 problems, any help is appreciated. Tab with Grids -------------- BL - fetching data from DB ( 5 secs - 10 rows) Grid Laod - 20 secs Grid Paint on tab change - 20 secs Problem: The...
1
by: Da-Breegster | last post by:
Hi. I'm attempting to write a roguelike (think nethack, crawl, angband, tome, adom, and yes, I suppose even rogue) in Perl and I've ran into a problem regarding the data structure for the map and...
1
by: Rushabh Dadbhawala | last post by:
Problem: I am fetching data from the database, storing it in a dataSet, and binding it with a Data Grid. The DataGrid controls allows sorting. The problem is that when the data is sorted on one...
2
by: Josef Meile | last post by:
Hi, I'm using a ComboBox, some Textboxes, and a DataGrid to represent a many-to-many relationship between Person and Course. Each time that I change the value in the ComboBox (which for now is...
7
by: Richard | last post by:
If the grid is dragged off the screen and back on the data is visible. Tried a dg.refresh() and Inactivate(). Can I do this by overriding custom base class OnPaint that my form inherits from? I...
3
by: pmud | last post by:
Hi, I have a web page (asp.net, code:c#). I havean html table with text boxes. Based on the user input , records are displayed in the data grid below it. Now the datagrid has a large no. of...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
9
by: Anil Gupte | last post by:
After reading a tutorial and fiddling, I finally got this to work. I can now put two tables created with a DataTable class into a DataRelation. Phew! And it works! Dim tblSliceInfo As New...
6
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1)...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.