ariel_au
April 1st, 2001, 10:19 AM
i created 2 forms named "frmMain" and "frmCustom". my problem is i can't get the values from "frmCustom" to be in "frmMain"
e.g my frmCustom have 2 textboxes and i wanted the values in the two textboxes goes to frmMain.
well, my code is in below:
'this is my frmMain.
option Explicit
private TotalCols as Integer
private TotalRows as Integer
'--------------------------------------------
private Sub Form_Load()
TotalCols = frmCustom.CWidth 'here is the problem, as i wanted the values from
TotalRows = frmCustom.CHeight 'frmCustom to be here...
Call LoadImagesOnForm
End Sub
'-----------------------------------------------------
private Sub LoadImagesOnForm()
Dim ImgCount as Integer
Dim RowCount as Integer
Dim ColCount as Integer
Dim FrmScalHghtDiff as Integer
Dim FrmScalWdthDiff as Integer
FrmScalHghtDiff = me.Height - me.ScaleHeight
FrmScalWdthDiff = me.Width - me.ScaleWidth
me.Height = (imgControl(0).Height * TotalRows) + FrmScalHghtDiff
me.Width = (imgControl(0).Width * TotalCols) + FrmScalWdthDiff
for RowCount = 1 to TotalRows
for ColCount = 1 to TotalCols
ImgCount = ImgCount + 1
Load imgControl(ImgCount)
imgControl(ImgCount).Move (ColCount - 1) * imgControl(0).Width, _
(RowCount - 1) * imgControl(0).Height
imgControl(ImgCount).Visible = true
next
next
End Sub
below is my frmCustom:
'this is my frmCustom
'in this form there is 2 textbox named "txtHeight" and "txtWidth"
'there is also a command button named "cmdOK"
private Sub cmdOk_Click()
Dim CHeight as Integer, CWidth as Integer
CHeight = Val(txtHeight.Text) 'here is the value taken from textbox
CWidth = Val(txtWidth.Text)
frmMain.TotalCols = CWidth 'here is the problem area...
frmMain.TotalRows = CHeight
If (CHeight * CWidth) Mod 2 <> 0 then
MsgBox " the values generate an odd number of image;" & vbCrLf & _
"change Width and/or Height so that their product" & _
"return an even number.", vbExclamation
ElseIf (CHeight * CWidth) > 50 then
MsgBox "Sorry, their product is too big;" & vbCrLf & _
"change Width and/or Height so that their product" & vbCrLf & _
"is lower than " & totalImg & ", or change the img Folder on" & vbCrLf & _
"the main window.", vbExclamation
End If
Unload me
End Sub
e.g my frmCustom have 2 textboxes and i wanted the values in the two textboxes goes to frmMain.
well, my code is in below:
'this is my frmMain.
option Explicit
private TotalCols as Integer
private TotalRows as Integer
'--------------------------------------------
private Sub Form_Load()
TotalCols = frmCustom.CWidth 'here is the problem, as i wanted the values from
TotalRows = frmCustom.CHeight 'frmCustom to be here...
Call LoadImagesOnForm
End Sub
'-----------------------------------------------------
private Sub LoadImagesOnForm()
Dim ImgCount as Integer
Dim RowCount as Integer
Dim ColCount as Integer
Dim FrmScalHghtDiff as Integer
Dim FrmScalWdthDiff as Integer
FrmScalHghtDiff = me.Height - me.ScaleHeight
FrmScalWdthDiff = me.Width - me.ScaleWidth
me.Height = (imgControl(0).Height * TotalRows) + FrmScalHghtDiff
me.Width = (imgControl(0).Width * TotalCols) + FrmScalWdthDiff
for RowCount = 1 to TotalRows
for ColCount = 1 to TotalCols
ImgCount = ImgCount + 1
Load imgControl(ImgCount)
imgControl(ImgCount).Move (ColCount - 1) * imgControl(0).Width, _
(RowCount - 1) * imgControl(0).Height
imgControl(ImgCount).Visible = true
next
next
End Sub
below is my frmCustom:
'this is my frmCustom
'in this form there is 2 textbox named "txtHeight" and "txtWidth"
'there is also a command button named "cmdOK"
private Sub cmdOk_Click()
Dim CHeight as Integer, CWidth as Integer
CHeight = Val(txtHeight.Text) 'here is the value taken from textbox
CWidth = Val(txtWidth.Text)
frmMain.TotalCols = CWidth 'here is the problem area...
frmMain.TotalRows = CHeight
If (CHeight * CWidth) Mod 2 <> 0 then
MsgBox " the values generate an odd number of image;" & vbCrLf & _
"change Width and/or Height so that their product" & _
"return an even number.", vbExclamation
ElseIf (CHeight * CWidth) > 50 then
MsgBox "Sorry, their product is too big;" & vbCrLf & _
"change Width and/or Height so that their product" & vbCrLf & _
"is lower than " & totalImg & ", or change the img Folder on" & vbCrLf & _
"the main window.", vbExclamation
End If
Unload me
End Sub