943,627 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 5385
  • VB.NET RSS
Nov 1st, 2008
0

Help Web Browser Open File Dialog Problems

Expand Post »
Hello I'm new here and im a bit confused about a certain code i am trying to do.
The code is for opening the file dialog and when the object has been selected it would be shown in the web browser or open any file, the code i have done opens the file dialog box, but as too is this well the web browser starts to navigate thinking it can find the file but it always does not. Can anyone help with this problem i am having please ?.I am also unsure about how you can make custom settings and how they can work, the reason i want to know this is because i have made a transparency slider and also has a form colour changer, I just do not know how to get these prefrences set for the user so when he/she opens the form up it will be how they selected it.

Here is the code for the open file dialog problem i am having
VB.NET Syntax (Toggle Plain Text)
  1. Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
  2. WebBrowser1.Navigate(OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK)
  3. End Sub
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Lumnous is offline Offline
3 posts
since Nov 2008
Nov 2nd, 2008
0

Re: Help Web Browser Open File Dialog Problems

The code won't open a file since it never gets any file name. Try it this way:
VB.NET Syntax (Toggle Plain Text)
  1. Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
  2. If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
  3. WebBrowser1.Navigate(OpenFileDialog1.FileName)
  4. End If
  5. End Sub
now it may or may not open and show the file in the control. If you try to open exe or similar file, you'll get IE's "Run/Save/Cancel" -dialog.

What custom settings? Please, be more specific.
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008
Nov 2nd, 2008
0

Re: Help Web Browser Open File Dialog Problems

Click to Expand / Collapse  Quote originally posted by Teme64 ...
The code won't open a file since it never gets any file name. Try it this way:
VB.NET Syntax (Toggle Plain Text)
  1. Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
  2. If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
  3. WebBrowser1.Navigate(OpenFileDialog1.FileName)
  4. End If
  5. End Sub
now it may or may not open and show the file in the control. If you try to open exe or similar file, you'll get IE's "Run/Save/Cancel" -dialog.

What custom settings? Please, be more specific.
Its worked thankyou very much and what i mean by custom settings is like, Opacity on a slider, when they open the dialog box it will keep what they selcted to like 15% visible it would open the next time they would see it at 15% visibility
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Lumnous is offline Offline
3 posts
since Nov 2008
Nov 3rd, 2008
0

Re: Help Web Browser Open File Dialog Problems

One way is to store the value in application settings. From Project-menu select "<proj name> Properties" and Settings-tab. Add a new setting: SliderOpacity which type is Integer. You may also give it an initial value 15.

In your code you set and save the setting:
VB.NET Syntax (Toggle Plain Text)
  1. My.Settings.Item("SliderOpacity") = 15
  2. My.Settings.Save()
and read the setting:
VB.NET Syntax (Toggle Plain Text)
  1. Dim Opacity As Integer
  2. Opacity = CInt(My.Settings.Item("SliderOpacity"))
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008
Nov 3rd, 2008
0

Re: Help Web Browser Open File Dialog Problems

Click to Expand / Collapse  Quote originally posted by Teme64 ...
One way is to store the value in application settings. From Project-menu select "<proj name> Properties" and Settings-tab. Add a new setting: SliderOpacity which type is Integer. You may also give it an initial value 15.

In your code you set and save the setting:
VB.NET Syntax (Toggle Plain Text)
  1. My.Settings.Item("SliderOpacity") = 15
  2. My.Settings.Save()
and read the setting:
VB.NET Syntax (Toggle Plain Text)
  1. Dim Opacity As Integer
  2. Opacity = CInt(My.Settings.Item("SliderOpacity"))
Will that work ? i mean its one of them sliders things and it has multiple if statements so that if like....the ticker is on 9 it would be 50% visible. I'm sorry i cant post there codes right now I'm at college I am afraid.Seeing as i am at college at this very moment i better at least mention it's one of them ticker sliders and the default value is 18 could it corrupt the system?, and how would a background color work too ?. Thank you very much for the info on that code, since having had that information i have been able to open anything i want in my web browser including PDF files +Rep for you.
Last edited by Lumnous; Nov 3rd, 2008 at 10:00 am. Reason: Forgot to say thankyou
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Lumnous is offline Offline
3 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: SQL, Dataview, DataTable and DataAdapter.Update
Next Thread in VB.NET Forum Timeline: VB code.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC