1.当选择第一个组合框某个数据表后,在第二个组合列表框内把这个数据表的列名显示出来,
2.点击“获取列名”,选择某一个Excel表,在第三个组合列表框内把这个表的列名显示出来,
3.如果两个组合框内的列名一样,就勾选上对号。
以上的代码怎么写?谢谢指导
[此贴子已经被作者于2024/6/3 9:19:17编辑过]
获取选择的目录下的文件代码怎么改?
Dim dlg As New FolderBrowserDialog
If dlg.ShowDialog = DialogResult.Ok Then
MessageBox.Show("你选择的目录是:" & dlg.SelectedPath, "提示")
Dim ckl As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox4")
For Each dt As DataTable In DataTables
If dt.SourceType = 1 Then
ckl.Items.Add(dt.name)
End If
Next
End If
帮助看过了,还需要老师指点修改代码:
Dim dlg As New FolderBrowserDialog()
If dlg.ShowDialog() = DialogResult.OK Then
MessageBox.Show("你选择的目录是:" & dlg.SelectedPath, "提示")
Dim ckl As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox4")
Dim fileSystem As New FileSystem()
For Each file As String In fileSystem.GetFiles(dlg.SelectedPath)
ckl.Items.Add(File.name)
Next
End If
这段可以把一个表的列显示出来,如我要切换另一个表显示另一个表的列怎么修改代码?
Dim ck2 As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox2")
Dim dt As Table = Tables("脱贫户信息表")
Dim cvw As String = dt.getColVisibleWidth
Dim nms As New List(Of String)
For i As Integer = 0 To ck2.Items.count - 1 '获取已经勾选的列
If ck2.GetItemChecked(i) Then
nms.Add(ck2.Items(i))
Else
dt.Cols(ck2.Items(i)).Visible = False
End If
Next
For Each dc As DataCol In DataTables("脱贫户信息表").DataCols
ck2.Items.Add(dc.Name)
Next
[此贴子已经被作者于2024/6/3 16:02:01编辑过]
Dim ck2 As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox2")ck2.Items.clear
For Each dc As DataCol In DataTables("另一个表").DataCols
ck2.Items.Add(dc.Name)
Next