Visual Basic 6
VB 6 Books
"Visual Basic 6 from the Ground Up" by Gary Cornell
"Teach Yourself Visual Basic 6 in 21 Days" by Greg Perry
VB Links
VB-Helper
VB Helper How To - Free Visual Basic Programming Downloads Download all examples
VB Helper How To - Free Visual Basic Programming Downloads Download all how tos NEW
Introduction to Visual Basic 5.0 Programming Download the site
VB Explorer Sign-Up for Newsletter
Visual Basic Online Magazine
VB Tips & Tricks
Mabry Software's Home Page
WinSite: VisualBasic (VB) Files
Planet Source Code
The Development Exchange
Visual Basic Web Magazine
Chris & Tim's Web Site
Visual Basic - The Mining Co.
Kidware
Dutch Software Needs Ntescape 4
VB World
News Group - comp.lang.basic.visual
News Group - comp.lang.basic.visual.misc
autoserv@jps.net   Page Last Update 03-05-03
   
Questions I have
How can I use a string in place of a object
or control name?
Private Sub Command1_Click ()
Dim strWord As String
Dim intCount As Integer
Dim strWordAndCount As String
strWord = "Text"
intCount = 1
strWordAndCount = strWord & intCount
strWordAndCount.Text = "Help"
'Text1.Text = "Help"
End Sub
What I'm trying to do is make Text a string
then add a varibal to it so I can use a For Next
loop. I can do it with key1 but not Text1.
WritePrivateProfileString _
"Appic", "key1", _
Text1.Text, "vbs.ini"
WritePrivateProfileString _
"Appic", "key2", _
Text2.Text, "vbs.ini"
WritePrivateProfileString _
"Appic", "key3", _
Text3.Text, "vbs.ini"
WritePrivateProfileString _
"Appic", "key4", _
Text4.Text, "vbs.ini"
Solution
Dim g As Integer
Dim Pathx As String
Pathx = App.Path
Pathx = Pathx & "\"
For g = 1 To 13
WritePrivateProfileString "Appic", "key" & (g), _
Text1(g).Text, Pathx & "vbc.ini"
Next g
Use array
Put text box on form.
Right click on text box.
Select copy.
Right click on form.
Select paste.
Choose array.
Now Text1 is Text1(1)
Now right click on form and
select paste as many times as needed.
Error in Project
MSDN Library CD1:\SAMPLES\VB98\SDI\Sdinote.vbp
Sdi Sdinote Module1
If you minimize the app with toolbar on
you will get error message 380 Invalid Property Value
Sub ResizeNote()
' Expand text box to fill the form's internal area.
If frmSDI.picToolbar.Visible Then
'Error 380 Invalid Property Value
frmSDI.txtNote.Height = frmSDI.ScaleHeight - frmSDI.picToolbar.Height
frmSDI.txtNote.Width = frmSDI.ScaleWidth
frmSDI.txtNote.Top = frmSDI.picToolbar.Height
Else
frmSDI.txtNote.Height = frmSDI.ScaleHeight
frmSDI.txtNote.Width = frmSDI.ScaleWidth
frmSDI.txtNote.Top = 0
End If
End Sub
I found a problem with resize
I got an error 380 Invalid Property Value every time I minimized the
program. I had to put
frmMain.WindowState = vbMinimized
in the Form_Resize Sub
Old
Sub ResizeNote()
frmSDI.txtNote.Height = frmSDI.ScaleHeight - frmSDI.picToolbar.Height
frmSDI.txtNote.Width = frmSDI.ScaleWidth
frmSDI.txtNote.Top = frmSDI.picToolbar.Height
End Sub
New
Sub ResizeNote()
If frmSDI.WindowState = vbMinimized Then
frmSDI.txtNote.Height = 5000
Else
frmSDI.txtNote.Height = frmSDI.ScaleHeight - frmSDI.picToolbar.Height
frmSDI.txtNote.Width = frmSDI.ScaleWidth
frmSDI.txtNote.Top = frmSDI.picToolbar.Height
End If
End Sub
I first noticed the problem with Sdinote
MSDN Library CD1:\SAMPLES\VB98\SDI\Sdinote.vbp Module1
This same problem happend with other programs too
I tryed reinstalling VB 6 thinking one of my DLLs was bad
but the same problem was still there
My guess is that when the program minimizes it get a zero value
for the Height and it cant resize in a size of zero