How do I load a file when a specific combo option is selected

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Feb 2009
Posts: 11
Reputation: archangelzero6 is an unknown quantity at this point 
Solved Threads: 0
archangelzero6 archangelzero6 is offline Offline
Newbie Poster

How do I load a file when a specific combo option is selected

 
0
  #1
Apr 1st, 2009
I am writing a program and want to have a a file loaded to be written to a specific location on the drive when an option is selected in a combobox. Here is the code that I have:

  1. Private Sub ComboBox5_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox5.SelectedIndexChanged
  2. If ComboBox2.Text = "option" Then
  3. ComboBox5.Items.Add("File")
  4. If ComboBox5.Text = "File" Then
  5. loadfile.reasources.ep3()
  6. End If
  7. End If
  8. End Sub
  9. End Class
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 51
Reputation: martonx is an unknown quantity at this point 
Solved Threads: 8
martonx martonx is offline Offline
Junior Poster in Training

Re: How do I load a file when a specific combo option is selected

 
0
  #2
Apr 2nd, 2009
Do you mean you want to copy a file? Or you want to create a new file?
What do you mean to load a file to a specific location?
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 11
Reputation: archangelzero6 is an unknown quantity at this point 
Solved Threads: 0
archangelzero6 archangelzero6 is offline Offline
Newbie Poster

Re: How do I load a file when a specific combo option is selected

 
0
  #3
Apr 2nd, 2009
I am writing software to open a .bin file from a computer and write it to an external location (ie. via com1 or usb). To start things off I am just trying to get my program to load in the background a specific .bin file when a combobox option is selected. Then when a submit button is pressed the file is written to the external location. I hope I explained that simply.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 51
Reputation: martonx is an unknown quantity at this point 
Solved Threads: 8
martonx martonx is offline Offline
Junior Poster in Training

Re: How do I load a file when a specific combo option is selected

 
0
  #4
Apr 3rd, 2009
So you want to copy the file. Here is your code. When you choose from combobx the file option, then you should dim the source file path and destination path. When you press submit button, you should just copy the file

  1. Dim FileToCopy As String = "C:\test.bin"
  2. Dim NewCopy As String = "D:\NewTest.bin"
  3.  
  4. If System.IO.File.Exists(FileToCopy) = True Then
  5. System.IO.File.Copy(FileToCopy, NewCopy)
  6. MsgBox("File Copied")
  7. End If
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 11
Reputation: archangelzero6 is an unknown quantity at this point 
Solved Threads: 0
archangelzero6 archangelzero6 is offline Offline
Newbie Poster

Re: How do I load a file when a specific combo option is selected

 
0
  #5
Apr 3rd, 2009
thank you. I will try that right away. results soon to follow :\
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 11
Reputation: archangelzero6 is an unknown quantity at this point 
Solved Threads: 0
archangelzero6 archangelzero6 is offline Offline
Newbie Poster

Re: How do I load a file when a specific combo option is selected

 
0
  #6
Apr 3rd, 2009
so for each "IF" statement I would put the dim statement as well for each combobox option, so that when the submit button is pressed the "FileToCopy" is the one that goes along with the combobox option?
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 51
Reputation: martonx is an unknown quantity at this point 
Solved Threads: 8
martonx martonx is offline Offline
Junior Poster in Training

Re: How do I load a file when a specific combo option is selected

 
0
  #7
Apr 4th, 2009
Originally Posted by archangelzero6 View Post
so for each "IF" statement I would put the dim statement as well for each combobox option, so that when the submit button is pressed the "FileToCopy" is the one that goes along with the combobox option?
I sent you the solution. Please do something on your own. Be creative.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC