Click here to Skip to main content
15,902,938 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to Sort Dataset ? Pin
Abhishek Sur22-Mar-09 0:04
professionalAbhishek Sur22-Mar-09 0:04 
GeneralRe: How to Sort Dataset ? Pin
E_Gold22-Mar-09 1:03
E_Gold22-Mar-09 1:03 
GeneralRe: How to Sort Dataset ? Pin
Henry Minute22-Mar-09 2:23
Henry Minute22-Mar-09 2:23 
Questionhow to split this text file Pin
rizchi21-Mar-09 21:29
rizchi21-Mar-09 21:29 
AnswerRe: how to split this text file Pin
Nagy Vilmos21-Mar-09 21:37
professionalNagy Vilmos21-Mar-09 21:37 
AnswerRe: how to split this text file Pin
Xmen Real 21-Mar-09 23:47
professional Xmen Real 21-Mar-09 23:47 
AnswerRe: how to split this text file Pin
#realJSOP22-Mar-09 0:08
professional#realJSOP22-Mar-09 0:08 
GeneralRe: how to split this text file Pin
rizchi22-Mar-09 12:19
rizchi22-Mar-09 12:19 
thanks for your reply. I've tried to do that method, but i got problem in parse the string. The string has a blank space delimiters. But, when i use this code, the string can't be splitted. Thanks for your help

string line = "";
string[] fields = null;
string errorInfo = String.Empty;
this.openFileDialog1.ShowDialog();
if (!(this.openFileDialog1.FileName == null))
this.textBox3.Text = this.openFileDialog1.FileName;
string txt = this.textBox3.Text;
DataTable tbl = new DataTable("InputFile");
try
{
using (StreamReader sr = new StreamReader(txt))
{
// first line has headers
if ((line = sr.ReadLine()) != null)
{
fields = line.Split(new char[] { '\x20', '\x20' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string s in fields)
{
tbl.Columns.Add(s);
}
}
else
{
// it's empty, that's an error
throw new ApplicationException("The data provided is not in a valid format.");
}
// fill the rest of the table; positional
while ((line = sr.ReadLine()) != null)
{
DataRow row = tbl.NewRow();
fields = line.Split(new char[] { '\x20', '\x20' }, StringSplitOptions.RemoveEmptyEntries);

int i = 0;
foreach (string s in fields)
{
row[i] = s;
i++;
}
tbl.Rows.Add(row);

}
}
}
catch (Exception)
{
throw new ApplicationException("There was an error attempting to read the data. Please verify the data provided is in a valid format, is tab-delimited text, and includes only ONE header line.");
}
//return tbl;
this.dataGridView1.DataSource = tbl;
AnswerRe: how to split this text file Pin
Fayu23-Mar-09 4:41
Fayu23-Mar-09 4:41 
Question[Message Deleted] Pin
rizchi21-Mar-09 21:25
rizchi21-Mar-09 21:25 
AnswerRe: how to split this text file? Pin
Nagy Vilmos21-Mar-09 21:44
professionalNagy Vilmos21-Mar-09 21:44 
QuestionDeployment Help (V S 2005) Pin
varun.g21-Mar-09 19:12
varun.g21-Mar-09 19:12 
Questionunable to get appropriate data from access database to crystal report in C# Pin
aashish.saalvi21-Mar-09 17:26
aashish.saalvi21-Mar-09 17:26 
Questionwhat is c# object graphs Pin
dream_liner_7e721-Mar-09 14:03
dream_liner_7e721-Mar-09 14:03 
AnswerRe: what is c# object graphs Pin
Mycroft Holmes21-Mar-09 14:39
professionalMycroft Holmes21-Mar-09 14:39 
Questioni want to make an ip messenger can i get the information related on my project Pin
shomic.goyal21-Mar-09 11:52
shomic.goyal21-Mar-09 11:52 
AnswerRe: i want to make an ip messenger can i get the information related on my project Pin
fly90421-Mar-09 12:18
fly90421-Mar-09 12:18 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
shomic.goyal21-Mar-09 12:22
shomic.goyal21-Mar-09 12:22 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
fly90421-Mar-09 12:24
fly90421-Mar-09 12:24 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
shomic.goyal21-Mar-09 12:29
shomic.goyal21-Mar-09 12:29 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
fly90421-Mar-09 12:38
fly90421-Mar-09 12:38 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
shomic.goyal21-Mar-09 12:44
shomic.goyal21-Mar-09 12:44 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
fly90421-Mar-09 12:48
fly90421-Mar-09 12:48 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
Yusuf21-Mar-09 13:06
Yusuf21-Mar-09 13:06 
GeneralRe: i want to make an ip messenger can i get the information related on my project Pin
fly90421-Mar-09 13:10
fly90421-Mar-09 13:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.