Note that there are some explanatory texts on larger screens.

plurals
  1. POconvert string to int32 while adding datagrid items
    primarykey
    data
    text
    <p>Guys, sorry for the basic question. I try to find out but I still get stuck with it. I am new to programming so, if you guys can help me, it's mean a lot. Thanks. For this code to i got help from someone in this site.</p> <p>Here's my problem,I have a .txt data like this </p> <blockquote> <pre><code>10192 20351 30473 40499 50449 60234 10192 20207 30206 40203 50205 60226 10192 20252 30312 40376 50334 60252 </code></pre> </blockquote> <p>And this is my code, where I open the text file and parsing into numbers and put it to 6 columns datagrid.</p> <p>So my data turns out like this in datagrid:</p> <p>Column 1|Column 2|Column 3|Column 4|Column 5|Column 6</p> <p>10192 | 20351| 30473 | 40499 | 50449 | 60234 </p> <pre><code>private void Parsing_String(string filename) { List&lt;Row&gt; list = new List&lt;Row&gt;(); foreach (String str in File.ReadLines(filename)) { String[] strCols = str.Split(Convert.ToChar(" ")); list.Add(new Row() { Column1 = strCols[0].Substring(2), Column2 = strCols[1].Substring(2), Column3 = strCols[2].Substring(2), Column4 = strCols[3].Substring(2), Column5 = strCols[4].Substring(2), Column6 = strCols[5].Substring(2), }); } dg.ItemsSource = list; } public class Row { public string Column1 { get; set; } public string Column2 { get; set; } public string Column3 { get; set; } public string Column4 { get; set; } public string Column5 { get; set; } public string Column6 { get; set; } } </code></pre> <p>What I want to do is, I need the numbers sequentially row by row to put in some mathematics equation. And I need to convert the string into int. But I don't know how, I put some trial but failed.</p> <p>for example: first I put first line of rows in datagrid which contain 6 group of number and calculate it. Next, the second row. and so on. How can I get the number that i want and put it in mathematics equation.</p> <p>Thanks Anyway.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload