Visual Basic menu

Shout-Out

User Tag List

Thread: Visual Basic

Results 1 to 10 of 10
  1. #1
    B14d3r11's Avatar Sergeant Major
    Reputation
    9
    Join Date
    Jan 2007
    Posts
    179
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Visual Basic

    Im trying to learn Visual Basic to make a single program, i have some coding knowledge but none of Visual Basic. Im not going to ask for all the features at once im going to ask in parts and see what i can/can't figure out.

    1. File Browse
    Im trying to make it so when you click the Browse Button, it allows the person to find the location of the file. And then when selected it saves the file location like C:\Games\Random.txt

    Visual Basic
  2. #2
    Phygar's Avatar ( ͡° ͜ʖ ͡°)
    Reputation
    444
    Join Date
    Nov 2007
    Posts
    1,591
    Thanks G/R
    7/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    FileDialog Class

    If you don't know what this is I suggest you first learn about classes.
    Last edited by Phygar; 12-01-2011 at 11:56 PM.

  3. #3
    B14d3r11's Avatar Sergeant Major
    Reputation
    9
    Join Date
    Jan 2007
    Posts
    179
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like i said, I don't Know Visual Basic, also I learn better when not shown a wall of text but told in steps how to declare the FileDialog Class. Cause i am reading through that link you sent me, im not seeing how i can make Filedialog appear upon button click

    Code:
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    
        End Sub
    So can you assist me in this seeing how i can't find a tutorial on this. If i did i wouldn't be asking for assistance.

  4. #4
    Phygar's Avatar ( ͡° ͜ʖ ͡°)
    Reputation
    444
    Join Date
    Nov 2007
    Posts
    1,591
    Thanks G/R
    7/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check the examples at the bottom first and see if that answers any of your questions. I'm going to bed now so I won't be able to give you any other info till tomorrow

  5. #5
    sitnspinlock's Avatar Elite User CoreCoins Purchaser
    Reputation
    398
    Join Date
    Sep 2010
    Posts
    439
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    don't start with .net

    start with c or c++

  6. #6
    B14d3r11's Avatar Sergeant Major
    Reputation
    9
    Join Date
    Jan 2007
    Posts
    179
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Im sorry, this is actually easier for me which is kind of confusing but with what Phygar told me to do, i got that working. Im just trying to make the Read Only Textbox1 change depending on what i select so if i select Random.txt with
    Code:
    Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim myStream As Stream = Nothing
            Dim openFileDialog1 As New OpenFileDialog()
    
            openFileDialog1.InitialDirectory = "c:\"
            openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
            openFileDialog1.FilterIndex = 2
            openFileDialog1.RestoreDirectory = True
    
            If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
                Try
                    myStream = openFileDialog1.OpenFile()
                    If (myStream IsNot Nothing) Then
                        ' Insert code to read the stream here.
                    End If
                Catch Ex As Exception
                    MessageBox.Show("Cannot read file from disk. Original error: " & Ex.Message)
                Finally
                    ' Check this again, since we need to make sure we didn't throw an exception on open.
                    If (myStream IsNot Nothing) Then
                        myStream.Close()
                    End If
                End Try
            End If
        End Sub
    I want it to show C:\Games\Random.txt in the read only Textbox1

  7. #7
    2dgreengiant's Avatar ★ Elder ★


    Reputation
    1192
    Join Date
    Feb 2007
    Posts
    7,129
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You want the box to display thhe text 'C:\Games\Random.txt' or whats in that text file?
    If you need me you have my skype, if you don't have my skype then you don't need me.

  8. #8
    B14d3r11's Avatar Sergeant Major
    Reputation
    9
    Join Date
    Jan 2007
    Posts
    179
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes I want the box to display the text of 'C:\Games\Random.txt' aka the files address

  9. #9
    B14d3r11's Avatar Sergeant Major
    Reputation
    9
    Join Date
    Jan 2007
    Posts
    179
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So far, no success with my attempts. I am making progress though, i got the default layout for the program it looks nice for a V1 Release, now i just need to code it >.>
    Last edited by B14d3r11; 12-02-2011 at 09:50 AM.

  10. #10
    Phygar's Avatar ( ͡° ͜ʖ ͡°)
    Reputation
    444
    Join Date
    Nov 2007
    Posts
    1,591
    Thanks G/R
    7/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look at how to use the FileOk event FileOk Event

    You need to make a new FileDialog, and make a method to handle the FileOk event. In that method, you can have it read the text from the file as a string. You should be able to easily find out how to do that with google.
    Last edited by Phygar; 12-02-2011 at 05:34 PM.

Similar Threads

  1. [RELEASE] Visual Basic 2008 Codes
    By EmiloZ in forum Programming
    Replies: 25
    Last Post: 01-03-2009, 06:13 AM
  2. Visual Basic, I have an idea.
    By WoWLegend in forum World of Warcraft Bots and Programs
    Replies: 14
    Last Post: 11-11-2006, 02:36 PM
All times are GMT -5. The time now is 10:55 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search