Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello Team,

I need to upload a file to Website(my companies website as per business requirement)

Just for an Example... lets say... http://www.icoconverter.com
{Taking this website as an example so that I quetion will be cler to all}

On Webpage we have TextBox(to show file path) and "Browse" button.
When we click on browse button, OpenFile Dialog box is shown and user need to select the file and then File Path is being shown in TextBox.

And after the we can click on Convert button and File gets uploaded to server.

Problem/Issue: Is it possible that without clicking on 'Browse' button I can take path in Textbox?

I have done below working...

VB
Private Sub CommandButton1_Click()
Dim ie As New InternetExplorer 
Dim txtBox As Variant 
Dim path As String 
 
ie.Visible = True
ie.Navigate "http://www.MyTestWebsite.com"

Do While ie.Busy
Application.Wait (Now + TimeSerial(0, 0, 2))
Loop
 
path = "C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg"
txtBox = ie.Document.getElementsByName("image") 

txtBox.Value = path 'Noting is happend here..I am expecting Txtbox should so Path which we given

End Sub


Please help....
Posted
Comments
[no name] 29-Sep-14 8:57am    
Unless you are doing something really weird, TextBoxes have a Text property....
Pravinkarne.31 30-Sep-14 0:27am    
Sorry guys but you are not able to understand my quetion...
If possible can you plz give try with below code...in MS Excel (VBA Macro)...

Private Sub CommandButton1_Click()
Dim ie As New InternetExplorer
Dim txtBox As Variant
Dim path As String

ie.Visible = True
ie.Navigate "http://www.icoconverter.com"

Do While ie.Busy
Application.Wait (Now + TimeSerial(0, 0, 2))
Loop

path = "C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg"
txtBox = ie.Document.getElementsByName("image")

txtBox.Text = path 'Noting is happend here..I am expecting Txtbox should so Path which we given

End Sub

This is all about Web Crawler and not just syntax issue...Plz help!!!

1 solution

VB
txtBox.Value = path 'Wrong

txtBox.Text = Convert.ToString(path) 'Right
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Sep-14 10:40am    
There is no need to "convert" string to string. Sorry, this is a big fat "1".
Please, if you put answers, you need to feel some responsibility for the readers. Some naive readers could be easily confused, and so on. So, first principle should be "don't do evil". "Help" would be the next.
—SA
KaushalJB 1-Oct-14 6:22am    
Sorry for the menace, but i have a habit of using Covert.ToString() every where as it handles null values very well. Next time would make sure to "Help" :-)
Sergey Alexandrovich Kryukov 1-Oct-14 12:07pm    
:-)
Pravinkarne.31 30-Sep-14 0:25am    
Sorry guys but you are not able to understand my quetion...
If possible can you plz give try with below code...in MS Excel (VBA Macro)...

Private Sub CommandButton1_Click()
Dim ie As New InternetExplorer
Dim txtBox As Variant
Dim path As String

ie.Visible = True
ie.Navigate "http://www.icoconverter.com"

Do While ie.Busy
Application.Wait (Now + TimeSerial(0, 0, 2))
Loop

path = "C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg"
txtBox = ie.Document.getElementsByName("image")

txtBox.Text = path 'Noting is happend here..I am expecting Txtbox should so Path which we given

End Sub
Pravinkarne.31 30-Sep-14 0:27am    
This is all about Web Crawler and not just syntax issue...Plz help!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900