DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   Help Web Browser Open File Dialog Problems (http://www.daniweb.com/forums/thread154802.html)

Lumnous Nov 1st, 2008 7:14 pm
Help Web Browser Open File Dialog Problems
 
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
 Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        WebBrowser1.Navigate(OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK)
    End Sub

Teme64 Nov 2nd, 2008 4:13 pm
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:
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
  If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
    WebBrowser1.Navigate(OpenFileDialog1.FileName)
  End If
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.

Lumnous Nov 2nd, 2008 5:30 pm
Re: Help Web Browser Open File Dialog Problems
 
Quote:

Originally Posted by Teme64 (Post 726834)
The code won't open a file since it never gets any file name. Try it this way:
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
  If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
    WebBrowser1.Navigate(OpenFileDialog1.FileName)
  End If
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

Teme64 Nov 3rd, 2008 3:40 am
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:
My.Settings.Item("SliderOpacity") = 15
My.Settings.Save()
and read the setting:
Dim Opacity As Integer
Opacity = CInt(My.Settings.Item("SliderOpacity"))

Lumnous Nov 3rd, 2008 9:54 am
Re: Help Web Browser Open File Dialog Problems
 
Quote:

Originally Posted by Teme64 (Post 727219)
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:
My.Settings.Item("SliderOpacity") = 15
My.Settings.Save()
and read the setting:
Dim Opacity As Integer
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.


All times are GMT -4. The time now is 1:39 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC