-
If You Have an EXAMPLE form of these so i can see send it to [email protected]
First question is:
Using *VB5*
how do u make an image turn to a different one when your mouse moves over it and turn back when the mouse leaves??
Second one:
Using a Command button, how do u make it do an action when you RIGHT click it with your mouse?
Third Question:
i've heard of the GET & PUT commands to save and open documents.. can someone give me an example of doing this using 2 Text Fields
Text1.text and Text2.text saving to the SAME file "Text Box.txt"
-
I would assume that you would simply change the image on a mouse_enter or equivalant.
I think there's an option on the click for index? that is the index of hte mouse button that clicked it.. if index = right mouse, I think. I'm at work and don't have VB at this computer. Hope it helps.. if I'm right. :-)
-
1. Make an Image Appear in a Picturebox when the Mouse is Over it, (Can Easily be adapted to show a Different Picture(s))..
Code:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Picture1.Picture.Handle Then Picture1 = LoadPicture("")
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Picture1.Picture.Handle = 0 Then
Picture1 = LoadPicture("..\Common\Graphics\Bitmaps\Assorted\Happy.bmp")
End If
End Sub
2. Use the Mouse_Down/Mouse_UP Events, eg.
Code:
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then MsgBox "Command Button Right Click"
End Sub
3. PUT/GET are used when Opening a File for Binary/Random Access, they allow you to transfer Data in User-Defined Portions, this is especially useful when you create your own Type Structure of a Fixed Length, as you can then use the File as a Random Access File, eg.
Code:
Private Type MyType
sString As String * 10
iInteger As Integer
lLong As Long
End Type
Private Sub Command1_Click()
Dim tMyRecord(2) As MyType
Dim tSelected As MyType
tMyRecord(0).sString = "Aaron"
tMyRecord(0).iInteger = 10
tMyRecord(0).lLong = 128000
tMyRecord(1).sString = "Young"
tMyRecord(1).iInteger = 1234
tMyRecord(1).lLong = 64000
tMyRecord(2).sString = "VB6.0"
tMyRecord(2).iInteger = 78
tMyRecord(2).lLong = 256000
Open "C:\Test.txt" For Random Access Write As 1
Put #1, , tMyRecord(0)
Put #1, , tMyRecord(1)
Put #1, , tMyRecord(2)
Close 1
Open "C:\Test.txt" For Random Access Read As 1
'Ge the 2nd Record
Get #1, 2, tSelected
Close 1
Debug.Print tSelected.sString, tSelected.iInteger, tSelected.lLong
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
For the PUT and GET commands, an easier way would be the following:
Open "C:\Text Box.txt" for output as #1
write #1, text1.text, text2.text
close # 1
That's it.
Regards,
Alexander McANdrew
VB Zone http://gsenterprise.server101.com