473,397 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

creating a browse button with VB6

I need some help for creating a button that can allow the users to browse to a location and upload a file. I am new to VB, and any help would be greatly appreciated.
Nov 2 '07 #1
5 12878
Dököll
2,364 Expert 2GB
I need some help for creating a button that can allow the users to browse to a location and upload a file. I am new to VB, and any help would be greatly appreciated.
Glad to help you, NasirMunir...

Do you have anything working thus far?

Dököll
Nov 3 '07 #2
debasisdas
8,127 Expert 4TB
Try use Microsoft CommonDialog control for the purpose . Use the search box on the top right side of your page for further details.
Nov 3 '07 #3
This is what I would use.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdLoad_Click()
  2. If lstLoad.ListCount > 1 Then lstLoad.Clear
  3. On Error GoTo Cancelled
  4.  
  5.     cdlcommon.DialogTitle = "Load List"
  6.     cdlcommon.CancelError = True
  7.     cdlcommon.InitDir = App.Path
  8.     cdlcommon.Flags = &H4
  9.     cdlcommon.Filter = "Text File (*.txt)|*.txt|All files (*.*)|*.*"
  10.     cdlcommon.ShowOpen
  11. Cancelled:
  12.  
  13. End Sub
Don't forget to add the Microsoft Common Dialog Control.

Then to take the file you loaded you would use cdlcommon.filename

Example: I would use a function to add it to a list.

Call LoadFile(cdlcommon.FileName)

Expand|Select|Wrap|Line Numbers
  1. Private Function LoadFile(strFile As String)
  2. On Error Resume Next
  3. Dim opt As Integer, tmpStr As String
  4. opt = FreeFile
  5. Open strFile For Input As #opt
  6. While Not EOF(opt)
  7.     Input #opt, tmpStr
  8.     lstLoad.AddItem tmpStr
  9. Wend
  10. Close #opt
  11. End Function
Nov 3 '07 #4
Ali Rizwan
925 512MB
I need some help for creating a button that can allow the users to browse to a location and upload a file. I am new to VB, and any help would be greatly appreciated.
Here is a simple way for browse button...
Add Microsoft common control to your form.
and add this code to your browse buttons code.

Expand|Select|Wrap|Line Numbers
  1. commondialog1.showopen
  2. commondialog1.filter="*.txt|Text Files|*.*|All Files" ' You can add or change this filter.
  3. msgbox "You have choose"&commondialog1.filename

Now your browse button is ready to work.

GOOD LUCK
ALI
Nov 4 '07 #5
Thanks to all.
After banging my head for few days, I figured it out how to do that :). I was not aware of command dialog box. At any rate, thanks again for all the help.

Here is a simple way for browse button...
Add Microsoft common control to your form.
and add this code to your browse buttons code.

Expand|Select|Wrap|Line Numbers
  1. commondialog1.showopen
  2. commondialog1.filter="*.txt|Text Files|*.*|All Files" ' You can add or change this filter.
  3. msgbox "You have choose"&commondialog1.filename

Now your browse button is ready to work.

GOOD LUCK
ALI
Nov 4 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ron Brennan | last post by:
Good afternoon. The entire task that I'm trying to achieve is to allow a user to browse and upload multiple files simultaneously, hiding the Browse button of <input> tags of type="file" and...
1
by: Chris Lasher | last post by:
Hello, I'm trying to write a tool to scrape through some of the Ribosomal Database Project II's (http://rdp.cme.msu.edu/) pages, specifically, through the Hierarchy Browser....
5
by: Fred | last post by:
Hi I am searching for a module, that would allow me to call files by using a 'browse' button. Is there any uniform module for browsing files, or is there a special module for *.txt files? Thanks...
5
by: Ron Brennan | last post by:
Good afternoon. The entire task that I'm trying to achieve is to allow a user to browse and upload multiple files simultaneously, hiding the Browse button of <input> tags of type="file" and...
3
by: oopaevah | last post by:
I want to have a separate button which invokes the "browse" button on an input type=file. In internet explorer the following code works ok, in firefox nothing happens. All I do is call click()...
4
by: developing | last post by:
Hi All, I have a browse button that the user can click to select a file. The button then fetches the file path. This is all working fine except my boss wants some add functionality. I need it to...
1
by: ipa | last post by:
Hello, I made one browse button in asp form to store files. Now i am facing the problem is when i am editing that asp form. In that i call browse button during edit.but during edit, that...
4
by: Beb | last post by:
I have created a browse button to upload files, that part works fine but after I navigate to the file and collect the file grab it, there is no why for me to submit it for upload. How do I direct...
4
vikas251074
by: vikas251074 | last post by:
How can I create browse button in ASP using JavaScript. Onclicking browse button, an explorer windows should open from which user should select file for attachment. Thanks and regards, Vikas
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.