Page 1 of 2 12 LastLast
Results 1 to 40 of 57

Thread: Writing my first program. Seeking veteran VB user help.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Posts
    20

    Writing my first program. Seeking veteran VB user help.

    Hi, I am a 16 year old who just decided to create a program with my dad's VB6, I have been interested in making programs before but I've never got my mind set to do so.

    The program itself shouldn't be very complex (But what do I know about VB? ) it is a personalized image viewer of sort.

    First I want to make a splash screen for my program, but as I run the program, it goes straight to my frmMain and skips the splash screen completely.

    If anyone out there is willing to help me. I will send you my progress as I go along, explain what I'm trying to achieve with my program via pictures, and I will most definately be grateful and include a thanks to you in my program. (It's not much, but I guess a way of showing gratitude.)

    Hopefully someone out there will be willing to help me build my program step by step. All help will be appreciated.

  2. #2
    Hyperactive Member schuurke28's Avatar
    Join Date
    Feb 2001
    Posts
    402
    this is how u can set the spash screen to be the first screen to show:

    Select project in the menu, choose project properties.
    There u can select which form is the startup form, choose your splash screen

  3. #3
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    I Just turned 17 and i have to save your in for the time of your life cuz vb is fun and easy . I have created complex and simple programs.

    About the splash screen if you want have it load when your form loads and have it load it MODAL to your form like
    Code:
    Private Sub Form_Load()
    frmSplash.Show Modal, Me
    End Sub
    try it.
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Posts
    20
    Thank you schuurke28 and JasonLpz for your help in the beginning of my first program. Your help does not go unappreciated.

    What I want to achieve in my program, is to create an image viewer.

    So in frmMain I will have imgMain which will show images which have been pre-selected by an existing database. There will be 2 buttons, cmdNext and cmdPrevious and a drop-down list for navigation through the images.

    Now, my dad has told me that to do that I need to create the database first and link it to the controls.

    Could anyone help me out to create a database and how to link them with my controls?

    PS. Once again, the splash screen help worked succesfully. Thank you for your help.

  5. #5
    Fanatic Member
    Join Date
    Feb 2001
    Posts
    759
    Here is an example of images in a database. Courtesy of Beacon.

  6. #6
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    at the moment i just finished createing a image viewer if you would like some code or the program tell me its a simple image viewer no complex sH** lol. heres a image of it

    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  7. #7
    Lively Member
    Join Date
    Apr 2001
    Location
    Utah, USA
    Posts
    121
    I'm 16, been doing VB since version 3, it is pretty simple. I reccomend for simple database replacement the INI API, rather than worry about SQL and all INI's just make it really easy.

    I don't konw if I totally understand what you want, but eMail me if you want help, my eMail is in my profile...

    Josh

    [EDIT: I noticed that in the tutorial you actually have the image in the database, you can't do that with an INI file, it just saves the path, this is what I would recomend unless you actually want to use a database.]
    Last edited by Zevlag; Oct 14th, 2001 at 05:45 PM.
    Josh -- Name
    Zevlag13 -- AIM

    www.WotsIt.org for all your file format spec questions!

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Posts
    20
    Wow I am very impressed. May I get the code for your program so I could take a closer look at it?

    My e-mail address is [email protected]

  9. #9
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    i would also recommend writing and reading a ini file. A LOT easier than working with Databases.

    You can also e-mail me if ya need help. (see below)

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Posts
    20
    Thanks for all your help. I have yet more questions about VB, is it possible to make my program search an assigned folder for all files with the *.bmp extention whenever the program is started and put it in a list in a combo alphabetically so I could navigate them with ease?

    Also, is it possible for me to cue a sound clip as the splash screen is launched?

  11. #11
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by Almasy
    Thanks for all your help. I have yet more questions about VB, is it possible to make my program search an assigned folder for all files with the *.bmp extention whenever the program is started and put it in a list in a combo alphabetically so I could navigate them with ease?
    Drop a FileList control on a form, set the path and pattern properties.
    Also, is it possible for me to cue a sound clip as the splash screen is launched?
    See this tip http://www.vbsquare.com/graphics/tip402.html
    Last edited by chrisjk; Oct 14th, 2001 at 07:20 PM.

  12. #12
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    To play a sound use this.

    VB Code:
    1. 'Play A sound
    2. 'Paste this code into a bas module
    3. '
    4. 'API Function to play the sound
    5. '
    6. Declare Function sndPlaySound Lib "winmm" Alias _
    7. "sndPlaySoundA" (ByVal lpszSoundName As String, _
    8. ByVal uFlags As Long) As Long
    9. '
    10. ' play synchronously (default)
    11.     Public Const SND_SYNC = &H0
    12. ' play asynchronously
    13.     Public Const SND_ASYNC = &H1
    14. ' loop the sound until next
    15.     Public Const SND_LOOP = &H8
    16.  
    17. '=====================================================
    18.  
    19. 'Paste this code into the main
    20. 'from your main program (button or load or whatever):
    21. 'call the function using your wave file & location..replace "A:\whoosh.wav"
    22. '
    23.  Call sndPlaySound(ByVal "a:\whoosh.wav", SND_ASYNC)
    24. 'to stop it playing
    25.  call sndPlaySound("")

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Posts
    20
    Originally posted by chrisjk
    Drop a FileList control on a form, set the path and pattern properties.See this tip http://www.vbsquare.com/graphics/tip402.html
    Where would I enter the path properties? I can't seem to find it.

    Plus, How would I make it so that my imgMain will load the first item on the filelist and to navigate the filelist with cmdPrevious and cmdNext buttons?

  14. #14
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    http://www.vbsquare.com/graphics/tip402.html

    that tip is for playing a sound not the folder thing.

    I would just use the code i listed above to play the sound.

  15. #15
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    Zevlag:
    "[EDIT: I noticed that in the tutorial you actually have the image in the database, you can't do that with an INI file, it just saves the path, this is what I would recomend unless you actually want to use a database.]"

    And this is in reference to what!
    Look at the title: "Storing Images in an Access Database" i dont say anything about a .ini file! But you do make a good point though i'm pretty sure you could store an image in an .ini file but why the hell would you! Not the image but the binary data!

    Stickman:
    I disagree learn databases!

  16. #16
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    Originally posted by Beacon
    Stickman:
    I disagree learn databases! [/B]
    I didn't say he shouldn't learn them, but i think ini files would work fine for the job all that is needed is storing the path to the pictures.


    Maybe i misunderstand what he wants to do.

    Does he want to actually store the picture or just store where they are located so they can be viewed with the viewer?

  17. #17
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    oh sorry!!!

    Perhaps but what if he wants to say have them indexed as well by filename, title, description, extension, size, project etc etc. surely there's more extended choices in dtabases than in a .ini file.

  18. #18
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    I agree databases would be better for extended information and what not.

    And learning DB is a good idea anyways

  19. #19
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    Almasy I have sent you the source hope it helps you and plz no one else ask me for the source. If anyone needs help though tell me.
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  20. #20

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Posts
    20
    Ok maybe I should have been more clear on what I wanted to achieve. What I want is a Filelistbox which will show all the *.bmp files in an assigned folder. And when the program is first launched, it will automatically view the first item on the filelistbox.

    I want 2 commands cmdPrevious and cmdNext to allow navigation through the .bmp files of the filelistbox with ease. The pictures will be displayed in the imgMain

    I would like to be able to designate the folder and make presets (assigned directories i.e. c:\downloads\pictures1)

    P.S. I would like the filelistbox to list the files in alphabetical order

  21. #21
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    1 question did u make that program layout/skin or is it because the way your windows is setup?

  22. #22
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    yeah its a skin. So anyone can enjoy it lol
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  23. #23

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Posts
    20
    JasonLPZ, your program sure is impressive. I like how you created a custom skin for the program. What seemed annoying is it kept telling me I should register my ActiveSkin file . I'm very wowed by your skinning job and I was wondering how did you enforce it into your program, will it do that annoying register thing in the .exe form, and are there any other skins you can use.

  24. #24
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by Almasy
    Where would I enter the path properties? I can't seem to find it.
    Just enter them at runtime
    VB Code:
    1. Private Sub Form_Load()
    2.  
    3. File1.Path = "C:\My Documents\"
    4. File1.Pattern = "*.jpg;*.bmp"
    5.  
    6. End Sub

  25. #25
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407
    Hey JasonLpz could you send me the code and stuff for your menus and Close, Minimize, and Restore buttons? I really like that effect..e-mail it to me at [email protected]. Thanks.

  26. #26
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by Almasy
    I want 2 commands cmdPrevious and cmdNext to allow navigation through the .bmp files of the filelistbox with ease. The pictures will be displayed in the imgMain
    VB Code:
    1. Private Sub cmdBack_Click()
    2.  
    3. If File1.ListIndex >= 1 Then File1.ListIndex = File1.ListIndex - 1
    4.  
    5. End Sub
    6.  
    7. Private Sub cmdNext_Click()
    8.  
    9. If File1.ListIndex < File1.ListCount - 1 Then File1.ListIndex = File1.ListIndex + 1
    10.  
    11. End Sub

  27. #27

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Posts
    20
    Originally posted by chrisjk
    Just enter them at runtime
    VB Code:
    1. Private Sub Form_Load()
    2.  
    3. File1.Path = "C:\My Documents\"
    4. File1.Pattern = "*.jpg;*.bmp"
    5.  
    6. End Sub
    I put them exactly as you told but it resulted in runtime error '424' object required.

    *Edit* I fixed the name of the Filelistbox and it works wonders. Sorry for confusion
    Last edited by Almasy; Oct 14th, 2001 at 08:53 PM.

  28. #28
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Did you put a FileListBox on the form. It must be a filelist box, not a normal listbox

  29. #29
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    adding to chris's code:

    Private Sub Form_Load()

    File1.Path = "C:\My Documents\"
    File1.Pattern = "*.jpg;*.bmp"
    image1.picture = loadpicture(file1.list(0))

    End Sub

    off the top of me head!
    And chris r u on whizz??? What the time there?

  30. #30
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by Beacon
    And chris r u on whizz??? What the time there?
    No E's or Whizz...it's only 10 to 3

  31. #31
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    ok its a skin program by soft shape.

    http://www.softshape.com/activeskin/

    Its $99 (wow alot not really if you look around you can get it free) Ya all didnt hear it from me lol

    Anyway its asking you for the ocx registering cuz its not installed on your pc when the exe is made and you install it on your PC with the setup program, it will not ask for it it will be perfect (Hopefully lol)

    Almasy check your mail and

    chrisjk

    Its a FileListBox & DriveListBox & Text Box be creative and it will be worth it i had fun doing this program.
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  32. #32

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Posts
    20
    Thank you everyone for your support so far. Beacon, your addon to view the first image on the top of the list doesn't work for some reason it says the picture file does not exist.

    Now I would like to add a feature on the program. Is it possible to make an in program button, namely cmdDirectory to change the paths in the program?

  33. #33
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    Almasy - Here is a small portion of code to get you thinking of how to accomplish a image viewer.

  34. #34
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by JasonLpz
    chrisjk

    Its a FileListBox & DriveListBox & Text Box be creative and it will be worth it i had fun doing this program.
    Come again?
    Is it possible to make an in program button, namely cmdDirectory to change the paths in the program?
    Yes, just set the path like I showed you. You could use this code to enhance the usability by letting them chose from the Standard Windows dialog
    VB Code:
    1. Private Type BrowseInfo
    2.     hWndOwner As Long
    3.     pIDLRoot As Long
    4.     pszDisplayName As Long
    5.     lpszTitle As Long
    6.     ulFlags As Long
    7.     lpfnCallback As Long
    8.     lParam As Long
    9.     iImage As Long
    10. End Type
    11. Const BIF_RETURNONLYFSDIRS = 1
    12. Const MAX_PATH = 260
    13. Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
    14. Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
    15. Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
    16. Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
    17. Private Sub Form_Load()
    18.     'KPD-Team 1998
    19.     'URL: [url]http://www.allapi.net/[/url]
    20.     Dim iNull As Integer, lpIDList As Long, lResult As Long
    21.     Dim sPath As String, udtBI As BrowseInfo
    22.  
    23.     With udtBI
    24.         'Set the owner window
    25.         .hWndOwner = Me.hWnd
    26.         'lstrcat appends the two strings and returns the memory address
    27.         .lpszTitle = lstrcat("C:\", "")
    28.         'Return only if the user selected a directory
    29.         .ulFlags = BIF_RETURNONLYFSDIRS
    30.     End With
    31.  
    32.     'Show the 'Browse for folder' dialog
    33.     lpIDList = SHBrowseForFolder(udtBI)
    34.     If lpIDList Then
    35.         sPath = String$(MAX_PATH, 0)
    36.         'Get the path from the IDList
    37.         SHGetPathFromIDList lpIDList, sPath
    38.         'free the block of memory
    39.         CoTaskMemFree lpIDList
    40.         iNull = InStr(sPath, vbNullChar)
    41.         If iNull Then
    42.             sPath = Left$(sPath, iNull - 1)
    43.         End If
    44.     End If
    45.  
    46.     MsgBox sPath
    47. End Sub

  35. #35
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    Private Sub Form_Load()

    File1.Path = "C:\My Documents\"
    File1.Pattern = "*.jpg;*.bmp"
    image1.picture = loadpicture(file1.list(0))

    End Sub


    IS NOT WHAT I USE
    Code:
    I Use the below 
    Private Sub SkinButton1_Click()
    If File1.FileName = "" Then
    MsgBox "No File Selected", vbCritical, "No File"
    Unload Me
    Else
    Dim FileName As String
    If Text1.Text = "C:\" Then
    FileName = Text1 & File1.FileName
    Form1.Image1.Picture = LoadPicture(FileName)
    Unload Me
    Else
    FileName = Dir1.Path & "\" & File1.FileName
    Form1.Image1.Picture = LoadPicture(FileName)
    Unload Me
    End If
    End If
    End Sub
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  36. #36
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by JasonLpz
    IS NOT WHAT I USE
    A) I don't care
    B) Don't shout at me

  37. #37
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    WHY DO YOU GUYS TURN SOMETHING SIMPLE INTO A HELL > ALL THAT CODE ISNT NEEDED MAN JUST KEEP IT LOW
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  38. #38
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    You need to take some pills man, now let the grown ups discuss VB whilst you play with your Action Man.

  39. #39
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    Originally posted by chrisjk
    A) I don't care
    B) Don't shout at me

    If i was shouting at you i would put !!!!!!!!!!!!!!! im just making sure you all know what i dont use ok and too bad if you dont care . Do you get mood swings ?? LOL DONT Bark at me man.
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  40. #40
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    You say
    You need to take some pills man, now let the grown ups discuss VB whilst you play with your Action Man
    yet your a grown up ?????????????

    I Dont think so!
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width