VB Source in C#
-
Hi Leute, ich hab hier folgenden Source:
Public Sub CopyReferenceInformation() ' Copys description and name from referenced interface Dim counter As Integer Dim index As Integer Dim fromProject As String Dim toProject As String Dim descriptionInterface As String Dim nameInterface As String Dim idInterface As String Dim idDublette As String Dim counter2 As Integer Dim rowID As Integer Dim rowFrom As Integer Dim rowTo As Integer Dim rowName As Integer Dim rowDescription As Integer ' in wich row of the excelsheet can wie find the following values? rowID = 1 rowFrom = 2 rowTo = 3 rowName = 4 rowDescription = 5 rowReference = 6 'Dublette.number 'find references counter = 2 '2. Zeile Do While Worksheets("Schnittstellen").Cells(counter, rowID).Value <> Empty idInterface = Worksheets("Schnittstellen").Cells(counter, rowID).Value ' if Dubletteneintrag If Worksheets("Schnittstellen").Cells(counter, rowID).Value <> Empty Then idDublette = Worksheets("Schnittstellen").Cells(counter, rowReference).Value counter2 = 2 ' look for Referenceinterface Do While Worksheets("Schnittstellen").Cells(counter2, rowID).Value <> Empty ' if found reference copy values from reference If Worksheets("Schnittstellen").Cells(counter2, rowID).Value = idDublette Then Worksheets("Schnittstellen").Cells(counter, rowName).Value = Worksheets("Schnittstellen").Cells(counter2, rowName).Value Worksheets("Schnittstellen").Cells(counter, rowDescription).Value = Worksheets("Schnittstellen").Cells(counter2, rowDescription).Value Exit Do End If counter2 = counter2 + 1 Loop End If counter = counter + 1 Loop End Sub
diesen würde ich gern in C# Source umwandeln, also sprich neu schreiben. Meine Frage ist, wie ich die einzelnen Zellen in C# ansprechen kann. Bis jetzt hab ich dass hier geschrieben:
private void button_aktualisieren_Click(object sender, System.EventArgs e) { int i_numberanzahl; //SQL Zählung für Einträge ds = DBZugriff (str_SQLNumberanzahl, str_Filename); DataRow numberanzahl = ds.Tables["Table"].Rows[0]; i_numberanzahl = (int)numberanzahl[0]; i_numberanzahl = i_numberanzahl - 1; string[] str_numberarray = new string[i_numberanzahl]; string str_leer = ""; int i_counter1=0; int i_counter2=0; string idInterface; DataRow zeile = ds.Tables["Table"].Rows[i_counter1]; ausgabe[i_counter1] = zeile[0].ToString(); DataRow zeile2= ds.Tables["Table"].Rows[i_counter1]; ausgabe2[i_counter1] = zeile2[1].ToString(); i_counter1=1; while (zeile[0].ToString() != str_leer) { idInterface = zeile[0].ToString(); if (zeile[0].ToString() != str_leer) { iddublette = zeile2[1].ToString(); i_counter2=1; } while (ausgabe[i_counter2]
-
Ich denke Google kannst du selber benutzen?
Wenn ja kannst du dir mal Sharpdevelop runterladen, dort gibts einen experimentellen Quellcodeconverter. Ansonsten halt schnell mal C# lernen :xmas2:
-
Ok danke, aber kannst du mir nicht schnell ein bisschen helfen, wie ich die einzelnen Befehle umwandle...
-
Kann sein das dein VB Code mit nem Exelfile arbeitet und dein C# Code aber mit ner Datenbank weil du Dataset benutzt und so?