Code Convert vb6 to vb.net
-
hi, Anyone know how to convert the code below for vb6 to vb.net? here is my vb6 source code! Function LoadLR() dbrs.Open "select Badge,Time,Day,InOut From TimeAInfor where InOut='" + CStr("<") + "' and Month='" + CStr(Mid(Combo1(3).Text, 1, 2)) + "' and Year='" + CStr(Mid(Combo1(4).Text, 3, 2)) + "' order by Day", dbsql 'j = 0 For j = 0 To Form3.ListView1(2).ListItems().Count - 1 If dbrs.RecordCount <> 0 Then dbrs.MoveFirst For i = 0 To dbrs.RecordCount - 1 If Form3.ListView1(2).ListItems(j + 1).SubItems(1) = dbrs.Fields(0) Then h = DatePart("h", CStr(dbrs.Fields(1))) h = h * 60 n = DatePart("n", CStr(dbrs.Fields(1))) F = h + n If F < WorkIn Or F = WorkIn Then Form3.ListView1(2).ListItems(j + 1).SubItems(dbrs.Fields(2) + 1) = "-" Else If Form3.ListView1(2).ListItems(j + 1).SubItems(dbrs.Fields(2) + 1) <> "-" Then If F > WorkIn Then T = Form3.ListView1(2).ListItems(j + 1).SubItems(dbrs.Fields(2) + 1) If T = "" Then Form3.ListView1(2).ListItems(j + 1).SubItems(dbrs.Fields(2) + 1) = (F - WorkIn) Else If (F - WorkIn) < Val(T) Then Form3.ListView1(2).ListItems(j + 1).SubItems(dbrs.Fields(2) + 1) = (F - WorkIn) End If End If End If End If End If End If dbrs.MoveNext Next For i = 2 To 32 If Not Form3.ListView1(2).ListItems(j + 1).SubItems(i) = "" And Not Form3.ListView1(2).ListItems(j + 1).SubItems(i) = "-" Then totalLR = totalLR + Val(Form3.ListView1(2).ListItems(j + 1).SubItems(i)) End If Next Form3.ListView1(2).ListItems(j + 1).SubItems(33) = totalLR totalLR = 0 End If Next Call CloseTASystem For i = 0 To ListView1(2).ListItems().Count 'MsgBox ListView1(2).ListItems().Count If ListView1(2).ListItems().Count <> 0 The
-
hi, Anyone know how to convert the code below for vb6 to vb.net? here is my vb6 source code! Function LoadLR() dbrs.Open "select Badge,Time,Day,InOut From TimeAInfor where InOut='" + CStr("<") + "' and Month='" + CStr(Mid(Combo1(3).Text, 1, 2)) + "' and Year='" + CStr(Mid(Combo1(4).Text, 3, 2)) + "' order by Day", dbsql 'j = 0 For j = 0 To Form3.ListView1(2).ListItems().Count - 1 If dbrs.RecordCount <> 0 Then dbrs.MoveFirst For i = 0 To dbrs.RecordCount - 1 If Form3.ListView1(2).ListItems(j + 1).SubItems(1) = dbrs.Fields(0) Then h = DatePart("h", CStr(dbrs.Fields(1))) h = h * 60 n = DatePart("n", CStr(dbrs.Fields(1))) F = h + n If F < WorkIn Or F = WorkIn Then Form3.ListView1(2).ListItems(j + 1).SubItems(dbrs.Fields(2) + 1) = "-" Else If Form3.ListView1(2).ListItems(j + 1).SubItems(dbrs.Fields(2) + 1) <> "-" Then If F > WorkIn Then T = Form3.ListView1(2).ListItems(j + 1).SubItems(dbrs.Fields(2) + 1) If T = "" Then Form3.ListView1(2).ListItems(j + 1).SubItems(dbrs.Fields(2) + 1) = (F - WorkIn) Else If (F - WorkIn) < Val(T) Then Form3.ListView1(2).ListItems(j + 1).SubItems(dbrs.Fields(2) + 1) = (F - WorkIn) End If End If End If End If End If End If dbrs.MoveNext Next For i = 2 To 32 If Not Form3.ListView1(2).ListItems(j + 1).SubItems(i) = "" And Not Form3.ListView1(2).ListItems(j + 1).SubItems(i) = "-" Then totalLR = totalLR + Val(Form3.ListView1(2).ListItems(j + 1).SubItems(i)) End If Next Form3.ListView1(2).ListItems(j + 1).SubItems(33) = totalLR totalLR = 0 End If Next Call CloseTASystem For i = 0 To ListView1(2).ListItems().Count 'MsgBox ListView1(2).ListItems().Count If ListView1(2).ListItems().Count <> 0 The
Do you expect someone to type everything for you ¿ I'll just give advice. If I were you, I would look into ADO.NET, there are plenty samples on google. Retyping this in .NET, won't help much in any case, because .NET uses DataSets, DataAdapters etc. Just my 2 cents.. HTG CodeGuru Article Reviewer