如何让一个combo1的内容去影响另一个combo的内容
VB 新手求指点 ,谢了 !如何让一个combo1的内容去影响另一个combo的内容,如 combo1内容选一个省份,combo2中就显示所选省份包含的城市
Private Sub ComPinG_Click() Dim Data1() As String, Data2() As String Dim i As Integer, SelectGroupNum As Integer On Error GoTo ErrorHandling ComPinN.Clear: Erase SelectPin, ResltStatus SelectGroupNum = ComPinG.ListIndex + 1 PinAnalysis.GroupCount = LoadCompareData(SelectGroupNum) Exit Sub ErrorHandling: Call ErrorWriteBuff(NickName, CStr(i), "ComPinG_Click", Err.Number, Err.Description, "系統訊息") Resume Next End Sub
Private Function LoadCompareData(Num As Integer) As Integer Dim i As Integer, j As Integer Dim Temp1() As String, Temp2() As String ReDim SelectPin(0) For i = 0 To UBound(Path2) Temp1 = Split(Path2(i), ":") If UBound(Temp1) = 4 Then If InStr(Temp1(0), ".") <> 0 Then Temp2 = Split(Temp1(0), ".") If UBound(Temp2) = 1 Then If CInt(Val(Temp2(0))) = Num Then If Trim(Temp1(1)) <> "" Then ReDim Preserve SelectPin(j) SelectPin(j) = Val(Temp2(1)) & ". " & Trim(Temp1(1)) ComPinN.AddItem SelectPin(j) j = j + 1 End If End If End If Erase Temp2 End If End If Erase Temp1 Next i LoadCompareData = j - 1 End Function
Public Type Unit Max As Double Min As Double End Type Public Type Site_N Unit() As String Data() As String MinValue As Double MaxValue As Double AvgValue As Double MedianValue As Double Range() As Unit End Type Public Type PinD SiteData() As Site_N PinCount As Integer PinCount1 As Integer End Type Public Type Group PinData() As PinD GroupCount As Integer End Type Public PinAnalysis As Group
Private Sub ComPinN_Change() ....... End Sub
Private Sub Form_Load() Dim i As Integer Call INILoad For i = 0 To TestGroup - 1 ComPinG.AddItem i + 1 Next i End Sub
Public Sub INILoad() Dim FileNum As Integer, INICount As Integer, i As Integer Dim FileN As String, TempString As String, Temp() As String Dim UI As Boolean, CmpData As Boolean On Error GoTo ErrorHandling INICount = 0: UI = False: CmpData = False FileN = App.Path & "\ABC.ini" If IsFileExist(FileN) = True Then FileNum = FreeFile Open FileN For Input As #FileNum Do While Not EOF(FileNum) Line Input #FileNum, TempString TempString = Trim(TempString) If TempString <> "" Then If (InStr(TempString, "[") <> 0 And InStr(TempString, "]") <> 0 And InStr(TempString, "UISET") <> 0) Then UI = True: CmpData = False ElseIf (InStr(TempString, "[") <> 0 And InStr(TempString, "]") <> 0 And InStr(TempString, "DATA") <> 0) Then UI = False: CmpData = True TestGroup = Trim(Mid(TempString, InStr(TempString, "_") + 1, InStr(TempString, "]") - InStr(TempString, "_") - 1)) End If If UI = True Then If InStr(TempString, "SiteNum_ADD") <> 0 Then SiteStart = CInt(Val(Trim(Mid(TempString, InStr(TempString, "=") + 1)))) ElseIf InStr(TempString, "TableLength") <> 0 Then MyStructCount = CInt(Val(Trim(Mid(TempString, InStr(TempString, "=") + 1)))) End If ElseIf CmpData = True Then If InStr(TempString, "=") <> 0 Then ReDim Preserve Path1(INICount): ReDim Preserve Path2(INICount) Temp = Split(TempString, "=") If UBound(Temp) = 1 Then Path1(INICount) = Trim(Temp(0)) Path2(INICount) = Trim(Temp(1)) INICount = INICount + 1 End If Erase Temp End If End If End If Loop Close #FileNum Else MsgBox "Can't Find " & FileN End If Exit Sub ErrorHandling: TempString = "Load ABC.ini Error" Call ErrorWriteBuff(FileN, CLng(INICount), "INILoad", Err.Number, Err.Description, TempString) Resume Next End Sub