Visual Basic Dropbox txt file help

Status
Not open for further replies.

Vipervgts

Honorable
Oct 12, 2012
12
0
10,560
I'm trying to make a program that has a textbox and a button and make it so that when you press the button, it looks into a text file on dropbox, and reads it and if the textbox has the text that the text file has, make it trigger something. If somebody could please help me, I would really appreciate it. Thank you!
 

dmroeder

Distinguished
Jan 15, 2005
42
0
18,590
I'm a little late to this party. I use the following code to do exactly what you are after. The file I'm reading is in my dropbox public directory.

Dim myWebClient As New System.Net.WebClient 'the webclient
Dim file As New System.IO.StreamReader(myWebClient.OpenRead("DropboxFilePathGoesHere"))
textbox1.text = file.ReadToEnd()
file.Close()

Obviously in this example there is no error trapping so you will want make sure it doesn't crash in the event it does not find the file.
 
Dec 7, 2013
1
0
10,510
Thats actualy prety easy.

#first you define a new variable called "webs" for a new webclient


Dim webs as new net.webclient
dim passwordfile as string = "File link here make sure its in a public folder!"

try
if textbox1.text = webs.downloadstring(passwordfile) then
messagebox.show("Password right!"
else
messagebox.show("Wrong password")

Catch as an Exception

messagebox.show("Couldn't connect to the interet or the file doesn't exist anymore!")

end try



This is working i hope i helped you :)
 
Status
Not open for further replies.