Jump to content
Xtreme .Net Talk

Roswell

Members
  • Posts

    6
  • Joined

  • Last visited

About Roswell

  • Birthday 02/01/1983

Personal Information

  • Visual Studio .NET Version
    Visual Studio .NET Professional
  • .NET Preferred Language
    C#

Roswell's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Yes, I tried it but I dont know its full syntax.........also will it show the ALL items under the company/city/state etc ????. Suppose I want to have the values "1,2,3,4,5,6,7,8,9" the first items of last name, company......etc into an string array ??? how can i do that ??? and like the second item of each category in second string array and so on ? with Fonds regars,
  2. private void menuItem2_Click(object sender, System.EventArgs e) { this.openFileDialog1.FileName = "*.xls"; if (this.openFileDialog1.ShowDialog() == DialogResult.OK) { Excel.Workbook theWorkbook = ExcelObj.Workbooks.Open( openFileDialog1.FileName, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true); // get the collection of sheets in the workbook Excel.Sheets sheets = theWorkbook.Worksheets; // get the first and only worksheet from the collection // of worksheets Excel.Worksheet worksheet = (Excel.Worksheet)sheets.get_Item(1); for (int i = 1; i <= 10; i++) { Excel.Range range = worksheet.get_Range("A"+i.ToString (), "J"+i.ToString () ); System.Array myvalues = (System.Array)range.Cells.Value; string[] strArray = ConvertToStringArray(myvalues); listView1.Items.Add(new ListViewItem(strArray)); // } ExcelObj.Quit (); } } the above is the code for opening an excel file and put all the elements to list box which has 10 categories...........see snapshot now when I retrieve the list items as MessageBox.Show(listView1.items[0].Text); it works fine my question is it would NOT let me retrieve the value which is in the second or third category of listbox like 2, 3 or 4 through items[index] thingy........... please help also suggest the best method for retreiving excel data into c# arrays tahnksssssssssss
  3. Greetings, Well I'm implementing syntax analyzer for C language made in C#. I have a sample grammer containing loop,s conditional statements and blah blah.............I wrote their first and follows and made a parsing table in an Excel sheet. Now I've two problems 1.How can I get Excels columns into arrays in C# to implement syntax analyzer through stack. 2. Is there another data structure so that I can use it to get parsing table into arrays to implement syntax analyzer through stack ??? I'm just having problems getting the elements of parsing table. Rest is ok with my project Thanks
  4. Thank you both of you. Tihs line thingy has already been done. Let me brief you what I want to do, please have a look to the following code string[] tempArray = new string [rch.Lines.Length]; tempArray = rch.Lines; MessageBox.Show ("Characters are "+rch.TextLength.ToString ()); //number of char MessageBox.Show ("Lines are " +rch.Lines.Length.ToString ()); //how manylines, string gg; int count=0; string[] kk= new string[rch.Lines.Length]; for(int b = 0;b<tempArray[0].Length ;b++) { gg=tempArray[0].Substring(b,1); kk[count]=kk[count]+ tempArray[0].Substring (b,1); switch (gg) { case ("\n"): count ++; break; case (" "): count ++; break; case (" "): //detecting for tow white spaces count ++; break; } } // end for MessageBox.Show("there are " + count.ToString ()+ " words in line 1"); MessageBox.Show ("There are "+tempArray[0].Length.ToString ()+" characters in first line" ); What this code is doing is, while consider the for loop only, to count number of words in an array containing the first line of richtext box. But this switch case doenst work for "\n" i.e. new line and if a line has more than one white spaces then it wont work. I think the reason is this gg=tempArray[0].Substring(b,1); It is detecting the line 1 , char by char............... How can I fix my code for if a user enters more than one whitespaces and to detect the "\n" thingy. Warm Regards,
  5. Hi, I've to capture an enter event everytime when a user hit enter in richtext box for the new line. I want each line into array so that I could get each word separatly. How do I do that in c# ? Need some quick help with code. Regards,
×
×
  • Create New...