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

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.

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

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"))

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.