Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




DataGrid


Hi Members!

From where I can get help about Datagrid completely.Its properties, methods and events?

Thanks

shminhas




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Datagrid Help Please How To Auto-requery The Recordset To Update The Datagrid??
I would really appreciate some help. I am trying to get the datagrid to update after inserting some records from another table into it. If I wait a few seconds after the insert, I can do rs2.requery and that works but I would like to grid to refresh on its own if possible. I'm sure there is a way. Below is the sub from the form. The OnLoad just opens the tables, etc. And the other one does the sql statement for inserting. If I wait a few after the insert, I can requery on rs2 and it works. Any suggestions?

Thanks!


Private cn2 As ADODB.Connection
Private WithEvents rs2 As ADODB.Recordset

Dim DbFile As String
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim SQLstmt As String


Private Sub AddCmd_Click()
SQLstmt = "INSERT INTO PR2 SELECT classification, organization, state, email FROM PR1 WHERE Classification = '" & DataList1.Text & "'"
'Get the Records
Set rs = New ADODB.Recordset
rs.Open SQLstmt, cn, adOpenStatic, adLockOptimistic, adCmdText
rs2.Requery
DataGrid1.Refresh
Label3.Caption = "Selected Business Contacts (" & Trim(Str(rs2.RecordCount)) & ")"
End Sub


Private Sub Form_Load()

Set cn2 = New ADODB.Connection
cn2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database1.mdb;Persist Security Info=False"
cn2.CursorLocation = adUseClient
cn2.Open

Set rs2 = New ADODB.Recordset
rs2.Open "pr2", cn2, adOpenDynamic, adLockPessimistic, adAsyncFetch
Set DataGrid1.DataSource = rs2

DbFile = App.Path & "database1.mdb"
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & DbFile & ";" & _
"Persist Security Info=False"
cn.Open

End Sub

Adding Columns To A Datagrid And Binding The Datagrid To A Recordsource
I am working on a program in visual basic 6 that I inherited. I am trying to add a datagrid to a form, add colums to the datagrid(it gives you 2 columns at design time)and bind the datagrid to a recordsource.

I would appreciate any help.
Thanks

How Can I Drag A Cell From One Datagrid And Drop In Antoher Datagrid?
Hi,

I am beginner of VB. I wanna drag a cell from one DataGrid and drop in another one. How could I do that? Anybody knows, plesae give me a help. Thanks in advance!

Click Datagrid Row And Display Details To Another Datagrid
hello there..here i need help. i have a datagrid that retrieve data from database.what i want to do with the datagrid is when i click any rows of the datagrid it can display the details of the data (refer to the row that i click) to another datagrid.

is there possible to be done ?

i want to know if there is any procedure that can capture the datagrid row that i clicked

Refresh DataGrid(Microsoft DataGrid Control 6.0)
Hi,

I am having a problem refreshing the datagrid in the following scenario:

I have Form1 with ADODC control and DataGrid(Microsoft DataGrid Control 6.0). The grid (is used to display employee records) contains 5 columns (for example Office telephone number) . On clicking of a row on the grid the details window opens up. This window is used to update the employee information. On saving the employee record if Office telephone number is changed then the datagrid should be refreshed with latest data of the record. The refresh is done using the following command:
msgbox "activate"
adodcobject.refresh
datagridobject.refresh.

If the message box is commented then the refresh statements do not get executed. I need a solution for that.

Regards,
Rashmi.

Combo In Datagrid(button Property Of Datagrid)
Hi,
We are working on datagrid and want to know how the button property
of the datagrid used. We have been working on this and are stuck as
to how to use each cell of the grid as combo box.

Set Datagrid To Datagrid Returned From Function
I'm creating a DLL and in it, I return a datagrid object to the calling application, however, I can't figure out how to assign the datagrid to an object.

I put a blank datagrid on a form, and I tried putting the following into the Load Sub.

Set dgX = K9().Xdg()

I know that the functions are all working, it's the actual setting of the datagrid on the form, to that of the datagrid returned from the function.

Thanks for any assistance.

- Anthony

Copying A Cell From A Datagrid To Another Datagrid
My question is how to copy a datagrid cell to another datagrid cell?

for example; datagrid1 column 1, row 1 to datagrid2 column 2, row 3

I use

DataGrid1.Columns(1).CellValue(DataGrid1.RowBookmark(1)) to capture the value, but I don't know the expression how to copy to datagrid2

Thanks

How To Transfer Data In A Datagrid To Another Datagrid..?
Please help me in my project so that i can pass..

Im a freashman student in high school,
Im making a simple Computer Hardware Inventory system,

Datagrid1:
Item Description Serial Number Date Recorded
Mouse Optical SN-2007 03/27/2007


Datagrid2:
Item Description Serial Number Date Recorded


I want my data in datagrid1 will transfer to Datagrid2
please solve my problem..

youre help, is a big help to me!
Thank you in advance!! Godspeed!!

How Do I Get This Information Into A Datagrid Control (datagrid)???
I have this information that i want to call out of a file and put into a data grid.
"AL","Alabama"
"AK","Alaska"
"AS","American Samoa"
"AZ","Arizona"
"AR","Arkanzas"
"CA","California"
"CZ","Canal Zone"
"CO","Colorado"
"CT","Connecticut"
"DE","Deleware"
"DC","District of Columbia"
"FL","Florida"
"GA","Georgia"
"GU","Guam"
"HI","Hawaii"
"ID","Idaho"
"IL","Illinois"
"IN","Indiana"
"IA","Iowa"
"KS","Kansas"
"KY","Kentucky"
"LA","Louisiana"
"ME","Maine"
"MD","Maryland"
"MA","Massachusetts"
"MI","Michigan"
"MN","Minnesota"
"MS","Mississippi"
"MO","Missouri"
"MT","Montana"
"NE","Nebraska"
"NV","Nevada"
"NH","New Hampshire"
"NJ","New Jersey"
"NM","New Mexico"
"NY","New York"
"NC","North Carolina"
"ND","North Dakota"
"OH","Ohio"
"OK","Oklahoma"
"OR","Oregon"
"PA","Pennsylvania"
"PR","Puerto Rico"
"RI","Rhode Island"
"SC","South Carolina"
"SD","South Dakota"
"TN","Tennessee"
"TX","Texas"
"TT","Trust Territories"
"UT","Utah"
"VT","Vermont"
"VA","Virginia"
"VI","Virgin Islands"
"WA","Washington"
"WV","West Virginia"
"WI","Wisconsin"
"WY","Wyoming"

And i want to get it into a data grid.
How do i do this??????

How Do I Get This Information Into A Datagrid Control (datagrid)???
I have this information that i want to call out of a file and put into a data grid.
"AL","Alabama"
"AK","Alaska"
"AS","American Samoa"
"AZ","Arizona"
"AR","Arkanzas"
"CA","California"
"CZ","Canal Zone"
"CO","Colorado"
"CT","Connecticut"
"DE","Deleware"
"DC","District of Columbia"
"FL","Florida"
"GA","Georgia"
"GU","Guam"
"HI","Hawaii"
"ID","Idaho"
"IL","Illinois"
"IN","Indiana"
"IA","Iowa"
"KS","Kansas"
"KY","Kentucky"
"LA","Louisiana"
"ME","Maine"
"MD","Maryland"
"MA","Massachusetts"
"MI","Michigan"
"MN","Minnesota"
"MS","Mississippi"
"MO","Missouri"
"MT","Montana"
"NE","Nebraska"
"NV","Nevada"
"NH","New Hampshire"
"NJ","New Jersey"
"NM","New Mexico"
"NY","New York"
"NC","North Carolina"
"ND","North Dakota"
"OH","Ohio"
"OK","Oklahoma"
"OR","Oregon"
"PA","Pennsylvania"
"PR","Puerto Rico"
"RI","Rhode Island"
"SC","South Carolina"
"SD","South Dakota"
"TN","Tennessee"
"TX","Texas"
"TT","Trust Territories"
"UT","Utah"
"VT","Vermont"
"VA","Virginia"
"VI","Virgin Islands"
"WA","Washington"
"WV","West Virginia"
"WI","Wisconsin"
"WY","Wyoming"

And i want to get it into a data grid.
How do i do this??????

How To Get The Value From Listview To The Datagrid By The Datagrid's Button
how to get the value from listview to the datagrid by the datagrid's button.
since the datagrid is empty, so i cant retrieve the value of listview to the datagrid....


and here i had attach a sample... ..
so. pls help me to fix this problem...

DataGrid & ADO -- Why More Than One Datagrid Is Populated With One Query???
Hi,

I have an SStabbed GUI with a datagrid on each tab. I also have ONE ADO connection common to all (i.e. on the main form and not on a particular tab). My problem is that when I run a query to populate a datagrid on one tab, the other datagrids on another tab also gets populated with the same results.

The code is as follows:

    With Adodc1
            .RecordSource = "select * from PalletView where PalletNo=" & txtPalletNo.Text
            .Refresh
    End With
            
    Set dgdPallet.DataSource = Adodc1

For each different query on a tab, all I do is replace the 'dgdPallet' name with another datagrids name.

Any help would be much appreciated.

Thanks, Ash

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

                                    **** KNOWLEDGE IS LIMITLESS ! ****
    **** FOR EVERY KNOWLEDGEABLE, THERE EXISTS A MORE KNOWLEDGEABLE ! ****

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Passing The Row Text Of A Datagrid To Another Datagrid
hi everyone, please help me on how to pass the text of the datagrid to another datagrid. in my project, i want the user to click the row of the first datagrid and when he clicked it, it will pass the text of the first datagrid to the second datagrid. plese help me thnx!

How To Copy Data From Datagrid Another Datagrid?
my problem is like that---

now i have 2 datagrid---datagrid1 & datagrid2
and 2 adodc-----adodc1 & adodc2

i have build some text that link with adodc1,i wanna build a command button that when i press it then the data from the text will copy to datagrid 2 and i can save it.


can any 1 show me the way?

thanks

Add Datagrid Item To Datagrid
how can i add items from one datagrid to another?

Dispaying Datagrid In A Datagrid
how can i dispaly a data grid in another datagrid?

i am using ASP.NET with VB.NET as scripting language.

i am creating an application in which i have to dispaly a table1 data in grid.

table1 is joined with table2 and i have to display table2 data in datagrid which will be placed according to the row user clicks in first datagrid.

perhaps rediffmail's inbox will give u a better idea where we are clicking the (+) plus sign to see mail and again clicking (-) minus sign to close it.

but in this case it is displaying text area

i want to display datagrid

as i am new to asp.net i do not have any idea about it.

how can i do that?

advanced thanks.

Update Records In A Datagrid Without Using The Update Feature In The Datagrid
How can I cycle through all the records in a datagrid and update a table based on the values in each record of the datagrid. For example.

I have 3 fields in the datagrid
Invoice Num, Suffix, Record Type. Invoice Num is the same in every row, but Suffix and Record Type are different for every row. Without using the update feature in the datagrid itself, I want to loop through the datagrid to update all the rows in the grid. I tried to get a count of the rows in the datagrid, and then loop through by the count and get the values of the cells I need. I can only get a column count from the datagrid. I can get a count of the of the recordset, but I am not sure how I can use that to loop through the datagrid. Any suggestions? Here is what I have so far.


Code:

Dim dupcount As Integer
dupcount = (liRS.RecordCount)
If dupcount > 0 Then

For X = 1 To dupcount
DupUPdateSQL = "Update FREIGHT_MASTER Set DUPLICATE_CODE = 'D', AMOUNT_PAID = 0 Where PROBILL=TRIM('" & strCurProbill & "') and CARRIER_NUMERIC = TRIM('" & strCurCarrierNumber & "')"
dupUpdateRS.Source = DupUPdateSQL
dupUpdateRS.CursorLocation = adUseClient
dupUpdateRS.CursorType = adOpenStatic
dupUpdateRS.ActiveConnection = totalConn
dupUpdateRS.Open

DupUPdateSQL = "Update FREIGHT_FEES Set AMOUNT_PAID = 0 Where PROBILL=TRIM('" & strCurProbill & "') and CARRIER_NUMERIC = TRIM('" & strCurCarrierNumber & "')"
dupUpdateRS.Source = DupUPdateSQL
dupUpdateRS.CursorLocation = adUseClient
dupUpdateRS.CursorType = adOpenStatic
dupUpdateRS.ActiveConnection = totalConn
dupUpdateRS.Open

Next
End If
End If

Extracting Datagrid Textbox Value To A Textbox Outside Datagrid
Hello to everybody! I hope you all will be able to help me with this problem!

I have a textbox named 'Textbox2' which is inside a Datagrid. And I have a Label named 'Label1' which is declared outside the datagrid.

I tried to retrieve the 'Textbox2' value from datagrid to the 'Label1' value which is outside the datagrid.
I tried typing the below code...

Label1.text=Textbox2.text

But I get a error message, which is "Name 'Textbox2' is not declared."

Can u guys please help me on how can i retrieve a textbox value from a datagrid and assign it to another textbox value which is outside the datagrid.



Thank you very much!!

DataGrid
I'm working on an application thathas several Data Grids. The user determines which grid he needs and by clicking a command button calls the grid. Each grid views a different table in the same Access 2000 database

Reference to the correct database is in code and works fine. What is a problem is the size and format of the various fields. The properties do not allow me to define more then 2 fields, even though 5 fields are visible on the grid when I run the program.

Can the field properties be set in code? If this is the way to do it where can I find the proper syntax, VB help doesn't show this.

In an earlier version of the program I used a data control for each grid but this was cumbersome and, i believe, inefficient.

Any suggestions?

New Row In A Datagrid
How can I manualy put a new row at the bottom of a datagrid?

ASP Datagrid
Hi there,

I found this forum a great help for me folks for I got fixed all my problems with the answers you provided.

Further, is there anybody out there that knows a free component of ASP datagrid.

Thanks.

DataGrid
How do I get the value of a cell in a datagrid control?

Datagrid Help Please
Hi

Please can someone help me, just can't figure this one out, i think i have the basis right but not sure if this is the right way to achieve this. I have a datagrid on my for and above it a textbox "txtSearch" the datagrid is populated and connected to an access database using adodc1 (i haven't coded the connection) and what i am trying to do is if i start typing a name into the textbox the corresponding name must get matched in the datagrid. But the code below gives me a "Syntax error in FROM clause" and then a "cant refresh adodc1" error.



Code:
Private Sub txtSearch_Change()
adoCustomers.RecordSource = "Select * form Customers where Customer_Name & " Like "'" & txtSearch.Text & "'"
adoCustomers.Refresh
End Sub
I'm not sure if i'm on the right track, so please can someone advise me.

Many thanks

Help...Datagrid
Hi,

How can I make the record that I clicked from the datagrid be displayed on certain textboxes? I've tried using .movenext

gadorset.MoveNext
txtstudnum.Text = gadorset.Fields(0).Value
txtlastname.Text = gadorset.Fields(1).Value
txtfirstname.Text = gadorset.Fields(2).Value
txtmidname.Text = gadorset.Fields(3).Value
cbocourses.Text = gadorset.Fields(4).Value

But the first record is not longer displayed...

Please help

Need Help ^^ {datagrid}
i'm trying to show value from Form A into DGrid in Form B,but each time i tried this error display "Operation is not allowed when the object is closed.Close and Restart the program"

since the code quite long and i'm not sure which code is wrong,so i hope anybody whoever face similar prob before can give me a clue what is wrong.

Datagrid Help??
Hi.

I have a database program with options like: ADD,DELETE,EDIT Customer Details. Now,when the user ADD's data,it firsts convert the input to UPPERCASE,then saves it to the DB.(ACCESS DATABASE). The thing is....when the user clicks EDIT,then the data is DISPLAYED inside a DATAGRID and the UPDATE function is enabled,so the user can change the information. But how do i set the Datagrid that all the changes must be converted to Uppercase?

Please help.....

Thnx

Datagrid
I am need to be able to update the rows in my datagrid. Maybe by adding a column to the left of it with an edit button on each row. when the edit button is clicked it takes you to a new form to be able to update the information... how do I get this extra column and when it is clicked for it to know the row it is on. Here is my code for the data grid.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
DataGrid1.DataSource = GetDataSource()
DataGrid1.DataBind()

End Sub

Protected Function GetDataSource() As System.Collections.ICollection
Dim strConnection As String = "data source=jwallace;initial catalog=JulieWTest;password=testadmin;persist security info=True;user id=JW;workstation id=Jwallace;"
Dim cn As New System.Data.SqlClient.SqlConnection(strConnection)
cn.Open()

Dim strSql As String = "SELECT * FROM Gateway"
Dim da As New System.Data.SqlClient.SqlDataAdapter(strSql, cn)

'load a data set
Dim ds As New System.Data.DataSet()
da.Fill(ds, "files")

cn.Close()

Dim dv As New System.Data.DataView(ds.Tables("files"))

Return dv
End Function

DataGrid
Hi
Can any one give me a solution to change the forecolor of one specific column in dataGrid.

And is there any possible way to reach to a particular column on keypress event.

Look forward for your assistance.
Thank you

Datagrid
at present i am bringing data into a datagrid, and i want to be able change the color of the row depending on values in the recordset. Say if a video is overdue then display that video in red.
Is there any possible way to do this
Thanks in advance
Finbarr

Datagrid
i have use datagrid to display whatever content of my database
(use ado to connect)now, i provide the button "display",once the user click it, then the content display, otherwise it is empty. how to made the datagrid is "empty" once i run the program?thanks

Datagrid
I want to populate datagrid (thru some sql query) at the time of form load . How to do that?

Datagrid
hi, i am using a datagrid in my form,

whenever i try to edit the data in the grid i am getting this

error...

"Insufficient key column information for updating or refreshing"

how can i rectify this... please help...

Datagrid
I want to clear the datagrid. I mean I want to remove the items from datagrid. How to do that?

Datagrid
Hello!!
I need help in the visual basic datagrid control.I want so insert some values to fist collum in every line!

Datagrid
I have a datagrid bound to a dataenviroment that is connected to an access database. I need to select some records to show in the datagrid, the base to select them is a number in a textbox that is saved...

DataGrid
How do you format a particular column on datagrid...for example, data in database looks like 200105 and would like data shown on grid like 2001/05.

Datagrid
Hi,
Do you know how to change the back color of specific row in the datagrid ?

How To? Datagrid.
Hi.

i need to perform a sum operation on a datagrid column.

---------------------------------------------------------
For i = 0 To (DataGrid1.ApproxCount - 1)

DataGrid1.Row = i

If (DataGrid1.Columns.Item(3).Text <> "") Then
Somme = Somme + CDec(DataGrid1.Columns.Item(3).Text)
End If

Next i
---------------------------------------------------------
there is a problem with the visible rows.
the visible rows = 6 in the form

and my grid can have more rows.

how to do this

thanks

Datagrid
how do you code to allow tabing from one cell to next cell in a datagrid?

DataGrid.Row
I'd like to automatically highlight row on datagrid as users move next-previous-first-last. What method is used to highlight row?

DataGrid
When I select a column on a datagrid, I'd like to .additem the column name. How do I get the column name?

Datagrid
I was wondering if it is possible to set the datasource and recordsource property of a datgrid from within the code based on the what the user selects instead of presetting it in advanced like it is normally used. I need to display the data in a grid style format. If anyone knows how this is done I would be much appreiciated.

DataGrid
What's the equivalent of textbox.text = "" for a datagrid?

Datagrid
I´m doing a database program and in it I have a datacombobox and a datagrid. If the user chooses a name in the datacombobox that persons records should come up in the datagrid.
How do I do this?

Datagrid
Is it true that it is not possible to have a null cell within datagrid?

Datagrid....
Hi there..

is there any other component in VB that is similar to datagrid..
I find using datagrid troublesome..it doesnot has a combobox and multiuser access gives me errors...

Or is there any resources on the web that is dedicated to how to programme datagrid in a proper way..

Datagrid: Help Me Please
How can I get the contence of a selected field in a datagrid (for example the contence of row i, column 2) in a variable?

Please help me,
Thanks in advance

Datagrid
hi fols, i'm now trying to play around with datagrid and data envionment, i did a query set it into a datagrid and then when i execute i can't change the value in the cells, is there a property to change in order to be able to update my fields

I'll be among the best soon, very soon!!!

Copyright © 2005-08 www.BigResource.com, All rights reserved