|
-
Apr 22nd, 2006, 03:36 AM
#1
Thread Starter
Fanatic Member
linking 2 forms
Hi
i have 2 forms in my VB6 project(frmPrompt and frmKeyword).When I click on save in the frmkeyword form,I save the source text as ssource=txtsource.text,sdate=txtdate.text then I hide frmKeyword and I show frmPrompt,
VB Code:
Public ssource as string
Public sdate as string
'frmKeyword
Private sub cmdSave_click()
ssource=txtsource.text
sdate=txtdate.text(I use a datepicker for the date)
frmKeyword.Hide
frmPrompt.Show
the frmPromt contains a datepicker,and 2 comboboxes(a cbolanguage and cbosource)
when frmPrompt loads i want to hightlight in the cbosource the source(ssource) and I want to hide the Date picker and display a label containing sdate
'frmPrompt
Private Sub Form_Load()
Dim i As Integer
Dim sa As String
DTPicker.Visible = False
lbldate.Visible = True
lbldate.Caption = sdate
Rs2.Open "Select*from Source where SourceID=" & nar, SICA, adOpenStatic, adLockOptimistic
sa = Rs2!ArticleLanguage
Rs2.close
Select Case sa
Case "Arabic"
cbolanguage.ListIndex = 0
Case "English"
cbolanguage.ListIndex = 1
Case "French"
cbolanguage.ListIndex = 2
End Select
For i = 0 To cbosource.ListCount
If nar = cbosource.ItemData(i) Then
cbosource.ListIndex = i
End If
Next i
Display
End Sub
Private Sub cbolanguage_Click()
Dim slang As String
slang = cbolanguage.List(cbolanguage.ListIndex)
cbosource.Clear
Rs2.Open "select * from Source where ArticleLanguage='" & slang & "'", SICA, adOpenStatic, adLockOptimistic
Rs2.MoveFirst
Do While Not Rs2.EOF
cbosource.AddItem Rs2!ArticleSource
cbosource.ItemData(cbosource.NewIndex) = Rs2!SourceID
Rs2.MoveNext
Loop
Rs2.Close
cbosource.ListIndex = 0
End Sub
Public Sub Display()
Dim acount As Integer
If nar <> 0 Then
Rs1.Open "Select * from Article where SourceID = " & nar & " and Flag = 0 and ArticleDate like '" & sdate & "' ", SICA, adOpenStatic, adLockOptimistic
Do While Not Rs1.EOF
sCompleteFile = Trim(Rs1!CompleteFile)
lstArticle.AddItem sCompleteFile
acount = acount + 1
Rs1.MoveNext
Loop
Rs1.Close
End If
End Sub
For example,if in frmKeyword txtsource=DailyStar and sdate="21/04/2006"
I want when the frmPrompt loads to display 21/04/2006 in a label control(hide the datepicker) and highlight DailyStar in its corresponding combobox(cbosource) and display the updated list of Articles based on Rs1.Open "Select * from Article where SourceID = " & nar & " and Flag = 0 and ArticleDate like '" & sdate & "' ", SICA, adOpenStatic, adLockOptimistic
But it didn't work.
Can anyone help me to debug my code(the first event is save_click)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|