473,395 Members | 2,253 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,395 software developers and data experts.

An array and a datagrid

Hey all,

what's the best way to get the contents of an array into a datagrid, edit
the values, and then save edited values back into array format?

thanks,
rodchar
Nov 21 '05 #1
9 2453
Hi,

Here is an example that uses an arraylist.
http://www.onteorasoftware.com/Downl...todatagrid.zip

Ken
------------------
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:13**********************************@microsof t.com...
Hey all,

what's the best way to get the contents of an array into a datagrid, edit
the values, and then save edited values back into array format?

thanks,
rodchar
Nov 21 '05 #2
Ken,

Is there a way to get a comma-delimited field into an array list. I know I
can do it with split function but that only works with arrays.

rodchar

"Ken Tucker [MVP]" wrote:
Hi,

Here is an example that uses an arraylist.
http://www.onteorasoftware.com/Downl...todatagrid.zip

Ken
------------------
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:13**********************************@microsof t.com...
Hey all,

what's the best way to get the contents of an array into a datagrid, edit
the values, and then save edited values back into array format?

thanks,
rodchar

Nov 21 '05 #3
Rodchar,

A comma delimited field is just a string so that is easy to put in a
arraylist.
When you want first an object from it, that should go as well and than using
the split as you said and than into the arraylist would not be a problem as
well..

However than to use it in a datagrid will be iimpossible I think or with a
lot of work.

While when it is a file, this goes almost in one time.

\\\
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim file As String = "Test2.txt"
Dim path As String = "C:\Test1\"
Dim ds As New DataSet
Try
Dim f As System.IO.File
If f.Exists(path & file) Then
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn As New OleDb.OleDbConnection(ConStr)
Dim da As New OleDb.OleDbDataAdapter("Select * from " & _
file, conn)
da.Fill(ds, "TextFile")
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
DataGrid1.DataSource = ds.Tables(0)
End Sub
///
I hope this helps a little bit?
Cor

"rodchar" <ro*****@discussions.microsoft.com>
Ken,

Is there a way to get a comma-delimited field into an array list. I know I
can do it with split function but that only works with arrays.

rodchar

"Ken Tucker [MVP]" wrote:
Hi,

Here is an example that uses an arraylist.
http://www.onteorasoftware.com/Downl...todatagrid.zip

Ken
------------------
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:13**********************************@microsof t.com...
Hey all,

what's the best way to get the contents of an array into a datagrid, edit
the values, and then save edited values back into array format?

thanks,
rodchar

Nov 21 '05 #4
Hi,

You can only bind to a one dimensional array

Ken
--------------------
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:D0**********************************@microsof t.com...
Ken,

Is there a way to get a comma-delimited field into an array list. I know I
can do it with split function but that only works with arrays.

rodchar

"Ken Tucker [MVP]" wrote:
Hi,

Here is an example that uses an arraylist.
http://www.onteorasoftware.com/Downl...todatagrid.zip

Ken
------------------
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:13**********************************@microsof t.com...
Hey all,

what's the best way to get the contents of an array into a datagrid, edit
the values, and then save edited values back into array format?

thanks,
rodchar

Nov 21 '05 #5
thank you. this helps.

"rodchar" wrote:
Hey all,

what's the best way to get the contents of an array into a datagrid, edit
the values, and then save edited values back into array format?

thanks,
rodchar

Nov 21 '05 #6
Cor,

how exactly do I get the csv field into an arraylist?
I've tried
arrlist=ctype(arr,arrlist) dosen't work
"Cor Ligthert" wrote:
Rodchar,

A comma delimited field is just a string so that is easy to put in a
arraylist.
When you want first an object from it, that should go as well and than using
the split as you said and than into the arraylist would not be a problem as
well..

However than to use it in a datagrid will be iimpossible I think or with a
lot of work.

While when it is a file, this goes almost in one time.

\\\
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim file As String = "Test2.txt"
Dim path As String = "C:\Test1\"
Dim ds As New DataSet
Try
Dim f As System.IO.File
If f.Exists(path & file) Then
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn As New OleDb.OleDbConnection(ConStr)
Dim da As New OleDb.OleDbDataAdapter("Select * from " & _
file, conn)
da.Fill(ds, "TextFile")
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
DataGrid1.DataSource = ds.Tables(0)
End Sub
///
I hope this helps a little bit?
Cor

"rodchar" <ro*****@discussions.microsoft.com>
Ken,

Is there a way to get a comma-delimited field into an array list. I know I
can do it with split function but that only works with arrays.

rodchar

"Ken Tucker [MVP]" wrote:
Hi,

Here is an example that uses an arraylist.
http://www.onteorasoftware.com/Downl...todatagrid.zip

Ken
------------------
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:13**********************************@microsof t.com...
Hey all,

what's the best way to get the contents of an array into a datagrid, edit
the values, and then save edited values back into array format?

thanks,
rodchar


Nov 21 '05 #7
rodchar,

You can add everything to an arraylist with
myarraylist.add(whatever)

I hope this helps?

Cor

"rodchar" <ro*****@discussions.microsoft.com>
Cor,

how exactly do I get the csv field into an arraylist?
I've tried
arrlist=ctype(arr,arrlist) dosen't work
"Cor Ligthert" wrote:
Rodchar,

A comma delimited field is just a string so that is easy to put in a
arraylist.
When you want first an object from it, that should go as well and than
using
the split as you said and than into the arraylist would not be a problem
as
well..

However than to use it in a datagrid will be iimpossible I think or with
a
lot of work.

While when it is a file, this goes almost in one time.

\\\
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim file As String = "Test2.txt"
Dim path As String = "C:\Test1\"
Dim ds As New DataSet
Try
Dim f As System.IO.File
If f.Exists(path & file) Then
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended
Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn As New OleDb.OleDbConnection(ConStr)
Dim da As New OleDb.OleDbDataAdapter("Select * from " & _
file, conn)
da.Fill(ds, "TextFile")
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
DataGrid1.DataSource = ds.Tables(0)
End Sub
///
I hope this helps a little bit?
Cor

"rodchar" <ro*****@discussions.microsoft.com>
> Ken,
>
> Is there a way to get a comma-delimited field into an array list. I
> know I
> can do it with split function but that only works with arrays.
>
> rodchar
>
> "Ken Tucker [MVP]" wrote:
>
>> Hi,
>>
>> Here is an example that uses an arraylist.
>> http://www.onteorasoftware.com/Downl...todatagrid.zip
>>
>> Ken
>> ------------------
>> "rodchar" <ro*****@discussions.microsoft.com> wrote in message
>> news:13**********************************@microsof t.com...
>> Hey all,
>>
>> what's the best way to get the contents of an array into a datagrid,
>> edit
>> the values, and then save edited values back into array format?
>>
>> thanks,
>> rodchar
>>
>>
>>


Nov 21 '05 #8
Set the DataGrid's datasource property to the array/arraylist object.

Assign the DataGrid.Item(index) to the array/arraylist object.

Check out my article, "DataSet, DataGrid and the Treeview controls" at
developersdex.com.

with regards,
J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #9
when I bind my array to the datagrid, all I get is the length column, how do
I get the actual values to show up?
"Ravichandran J.V." wrote:
Set the DataGrid's datasource property to the array/arraylist object.

Assign the DataGrid.Item(index) to the array/arraylist object.

Check out my article, "DataSet, DataGrid and the Treeview controls" at
developersdex.com.

with regards,
J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Eugene | last post by:
Hello all, I've been trying to figure this out for a few days now, and still have no clue what's going on... I have a few related tables in MS Access (Clients, Cars, Sales), and a datagrid,...
2
by: Jason Coyne Gaijin42 | last post by:
I have seen several people looking for a way to access the Columns collection when using the AutoGenerate = true option. Some people have gotten so far as to find the private autoGenColumnsArray...
4
by: mirek | last post by:
Hello, is there a way how to create data view (via datagrid) of a 2dim. array? I've data which I've got via SOAP call - it is a customer list, I want to simply display it in an datagrid. Can...
3
by: AFN | last post by:
I need to manually create the data to be shown in a datagrid (or some data table object). Should I create an array and bind the array to the datagrid OR should I create a temporary dataset and...
4
by: Manny Chohan | last post by:
hi guys, my code is returning an array and i need to create datagrid so that i can have sorting and implement prev....next function on it to navigate. is there any way this can be done in...
7
by: Jed | last post by:
I have a web service method that returns an array of custom objects marked serializeable with fully described public properties. When I bind the results to a DataGrid I can access the properties...
1
by: epigram | last post by:
Well, conceptually this is what I want to do. I was hoping to use an ArrayList to build a (dynamic) array of string arrays, and then bind the ArrayList object to a DataGrid. I can do that, but it...
10
by: mark | last post by:
I have a simple windows application that has a function to read a csv file and enter the values into an array A as double(,). Also, an instance of form 2 (which has a DataGrid) is created and the...
4
by: mark | last post by:
(windows app not web) I have a procedure to populate a given datagrid (Datagrid1) with a dataset from an indexed data connection. It works: Globals: Dim FileName1 As String Dim DS As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.