vb改写成c#的问题提问 1C

Private Sub Cmdback_Click()
Unload Me
End Sub

Private Sub Comboclass_Click()
Refresh_culture
End Sub

Private Sub Combofour_Click()
Refresh_culture
End Sub

Private Sub Combospecialty_Click()
Dim i As Long
Dim Tmpspecialty As Long
If Combospecialty.ListIndex = 0 Then
Comboclass.Visible = False
Combofour.Visible = True
Else
Comboclass.Visible = True
Comboclass.Clear
Comboclass.AddItem "全部"
'装入二级类目
TmpType = MyClass.GetId(Combospecialty.Text)
MyClass.Load_by_Upper (TmpType)
i = 0
Do While Arr_ClassName(i) <> ""
Comboclass.AddItem Arr_ClassName(i)
i = i + 1
Loop
Comboclass.ListIndex = 0
End If
Refresh_culture
End Sub

Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)

xlSheet.Columns.AutoFit
Me.MousePointer = 11
For k = 0 To DataGrid1.Columns.Count - 1 'DataGrid所有的列数
xlSheet.Cells(1, k + 1) = DataGrid1.Columns(k).Caption '第一行为DataGrid的列标题
Next
DataGrid1.Scroll 0, -DataGrid1.FirstRow '导出前拉动过垂直滚动条,这个非常重要
DataGrid1.Row = 0
For i = 0 To DataGrid1.ApproxCount - 1 'DataGrid的所有行数

  For j = 0 To DataGrid1.Columns.Count - 1 'DataGrid所有的列数,若将此数改小到不拉DataGrid的垂直滚动条的时候能看见的行数的时候正常
     DataGrid1.Col = j
     xlSheet.Cells(i + 2, j + 1) = Adodc1.Recordset(j) 'DataGrid1.Text '从第二行显示'DataGrid的内容
  Next
 If i < DataGrid1.ApproxCount - 1 Then
   DataGrid1.Row = DataGrid1.Row + 1
 End If

Next
Me.MousePointer = 0
MsgBox "导出成功!"
xlApp.Visible = True
Set xlApp = Nothing 'Excel 处于当前窗体
Set xlBook = Nothing
Set xlSheet = Nothing
End Sub

Private Sub DataGrid1_Click()

End Sub

Private Sub Form_Load()
Dim i As Integer
'装入一级类目
Combospecialty.AddItem "全部"
MyClass.Load_by_Upper (0)
i = 0
Do While Arr_ClassName(i) <> ""
Combospecialty.AddItem Arr_ClassName(i)
i = i + 1
Loop
Combospecialty.ListIndex = 0
'不显示二级类目
Comboclass.Visible = False
Combofour.ListIndex = 0

End Sub
Private Sub Refresh_culture()
Dim TmpSource As String
TmpSource = "SELECT S.Student_Id as 学生序号,S.Student_Name as 姓名,S.BadgeID as 学号, " _
+ " C1.Class_Name as 专业名称,C2.class_name as 班级名称,convert(char,F.Student_Grade) as 学年,F.yearinput as 年度," _
+ "F.Cet_Four as 四级成绩, F.Cet_Six as 六级成绩, F.NationPC_Two as 全国计算机二级成绩, " _
+ "F.NationPC_Three as 全国计算机三级成绩, F.NationPC_Four as 全国计算机四级成绩, F.JsPC_Two as 江苏计算机二级成绩," _
+ "F.JsPC_Three as 江苏计算机三级成绩,F.Basicjudge_Type as 基本素质测评类型,F.Basicjudge_Score as 基本素质测评分,F.grow_score as 发展素质分," _
+ "F.Culture_Memo as 文化备注 " _
+ "FROM Students S,Classes C1,classes C2 ,Student_four F" _
+ " WHERE S.Class_Id = C2.Class_Id And S.student_ID=f.student_ID and C2.UpperId =C1.class_ID And S.Student_Id = F.Student_Id "
If Combospecialty.ListIndex <> 0 Then
If Comboclass.ListIndex = 0 Then
TmpSource = TmpSource + " and C1.class_name='" + Trim(Combospecialty.Text) + "'"
Else
TmpSource = TmpSource + " and C1.class_name='" + Trim(Combospecialty.Text) _
+ "' and C2.class_name='" + Trim(Comboclass.Text) + "'"
End If
End If

TmpSource = TmpSource + " and cast(F.Student_Grade as char)='" + Trim(Combofour.Text) + "'"
TmpSource = TmpSource + " order by s.student_ID asc"
Adodc1.RecordSource = TmpSource
Adodc1.Refresh
DataGrid1.Refresh

If Adodc1.Recordset.EOF = True Then
'MsgBox "没有数据可供导出!"
Command1.Enabled = False
Else
Command1.Enabled = True
End If

End Sub
图片说明
怎么在vs用c#实现这个功能
详细些,谢谢帮助

1个回答

vb改写成C#基本就是根据需求重写一遍了。你得雇个程序员帮你了。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐