Now, basically, I want to make a VB program that can recognise custom file types (not really custom, more on that later).
Basically, there are 2 crucial elements I am missing.
1. The ability to view images. Using Microsoft VB6, what type of object do I want to add for the images to display in, and what code do I need?
2. Reading a semi-custom file extension. Say I have renamed a file from: image.png to image.dgn for example. It is still a png image, but has a different name. So when you press cmd_open I need it to browse only for files that have the .dgn/.dgnet extension, and open them as .pngs.
I haven't used VB for 3 years now, and am VERY rusty. I can't even remember how to make a browser box to open files :confused:
Can someone provide me with code to do this, I hope to get back into learning VB one day.
Thanks,
BP
5 replies to this topic
#1
Posted 20 August 2007 - 10:31 PM
|
|
|
#2
Posted 21 August 2007 - 01:38 AM
Well you have to use the picture box object, and as for the code it depends on how you plan to open the image.
#3
Posted 21 August 2007 - 02:17 AM
Well, press a comand button "Open" (cmd_open) and you jsut chose a file like in most programs when you open a file.
BP
BP
#4
Posted 06 September 2007 - 09:35 AM
Just make a PictureBox and CommandButton object. Then put this code into Command1_Click()
Picture1.Picture = LoadPicture(app.path & "\picture.dgn")
I tested in VB6, works fine.
Picture1.Picture = LoadPicture(app.path & "\picture.dgn")
I tested in VB6, works fine.
#5
Posted 09 September 2007 - 11:00 PM
I did it with Common Dialog :)
Thanks for your help,
BP
Thanks for your help,
BP
#6
Posted 23 December 2010 - 07:53 PM
blueparukia said:
Now, basically, I want to make a VB program that can recognise custom file types (not really custom, more on that later).
Basically, there are 2 crucial elements I am missing.
1. The ability to view images. Using Microsoft VB6, what type of object do I want to add for the images to display in, and what code do I need?
2. Reading a semi-custom file extension. Say I have renamed a file from: image.png to image.dgn for example. It is still a png image, but has a different name. So when you press cmd_open I need it to browse only for files that have the .dgn/.dgnet extension, and open them as .pngs.
I haven't used VB for 3 years now, and am VERY rusty. I can't even remember how to make a browser box to open files :confused:
Can someone provide me with code to do this, I hope to get back into learning VB one day.
Thanks,
BP
Basically, there are 2 crucial elements I am missing.
1. The ability to view images. Using Microsoft VB6, what type of object do I want to add for the images to display in, and what code do I need?
2. Reading a semi-custom file extension. Say I have renamed a file from: image.png to image.dgn for example. It is still a png image, but has a different name. So when you press cmd_open I need it to browse only for files that have the .dgn/.dgnet extension, and open them as .pngs.
I haven't used VB for 3 years now, and am VERY rusty. I can't even remember how to make a browser box to open files :confused:
Can someone provide me with code to do this, I hope to get back into learning VB one day.
Thanks,
BP
Make a Picture Box and a Text Box.
Add the code below.
Private Sub Form_Load()
Me.Caption = "Pic Viewer"
Text1.Text = "Enter Pic Here"
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyReturn
Picture1.Picture = VB.LoadPicture(Text1.Text)
End Select
End Sub
Hope this helped! :c-thumbup:
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









