read from file to grid.
Amir Kobylinski
Hello everyone,I need to read data from a text file and put the result in a gird column, so is there any way to do that.:roll:
thank you.
unknown
Dear Amir,Disclaimer: your question does not say anything about the text file you would like to read, neither about the grid type nor its location. Allow me to guess that you are reading multiple rows into yet-to-be-created grid on some form.
I am not going to give you a ready to deploy cocu file, but I can tell you that it is possible.
For reading the data out of text file your are best off by using System.IO.StreamReader.ReadLine method. See MSDN's help on this.
One of pitfalls a beginning SAP programmer may fall into, is that your grid column must be based on No-Object UDT (=UserDefinedTable) in order to make use of SAPbobsCOM's UserTable method.
For more info see SAP SDK: COM UI DICSharpUIDIBasicAppCreateUserTablesFrmMain.cs
The easiest grid you will create using SwissAddonFramework.UI.Components.Grid - there are many examples of the grid on this website.
Manuel Marhold
Hi Amir,there is another way.
You can created a stored function in MSSQL-Server which ready the file (take a look in msdn for BULK INSERT) an return this with the stored function.
So you can read the data into the Grid by using ExecuteQuery on the Datatable of the grid.
Amir Kobylinski
I read the data from file using the system.io....but I need to create a table in the form like a grid
this table contains of one column so I readlline from the file and put the reasult in a system.data.datatable but I need something like dataviewgrid in which I can add rows. whcih are the lines of the file.
thank you.
Manuel Marhold
Hi Amir,take a look at the samples/help:
a Grid has a datatable in background, you have to fill the data into the datataable.
something like rows.add and setvalue.
0
Please sign in to leave a comment.
Comments
0 comments