Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Using WebBrowser to news


HatakeAzzi
 Share

Recommended Posts

Hi guys! I'm here again… Now I'll teach you to choose between WebBrowser or the original coming with engine for show "the news". First you'll need add a component... Project > Components > Microsoft Internet Controls. Well, go to **frmMainMenu** and add 2 **OptionButton** and change they names to: **optWeb** and **optIni**. Add a WebBrowser and change the name to: **webNews**

C'mon to codes  ;)

On **frmMainMenu**, find: **Private Sub Form_Load()**
And search for **Call MainMenuInit**. Bellow add:

```
If ReadINI("CONFIG", "News", App.Path & "\config.ini") = "Web" Then
        picNews.Visible = False
        webNews.Visible = True
        optWeb.Value = True
        optIni.Value = False
        webNews.Navigate "www.yoursite.com/news.php"
    ElseIf ReadINI("CONFIG", "News", App.Path & "\config.ini") = "Ini" Then
        picNews.Visible = True
        webNews.Visible = False
        optWeb.Value = False
        optIni.Value = True
    ElseIf ReadINI("CONFIG", "News", App.Path & "\config.ini") <> "Web" Then
        MsgBox "Your file, config.ini, has been changed and there is no automatic solutions. Please contact an administrator to fix the problem!"
        End
    ElseIf ReadINI("CONFIG", "News", App.Path & "\config.ini") <> "Ini" Then
        MsgBox "Your file, config.ini, has been changed and there is no automatic solutions. Please contact an administrator to fix the problem!"
        End
    End If
```
Now in event click of optWeb, add:

```
    If webNews.Visible = True Then
        Exit Sub
    Else
        Call WriteINI("CONFIG", "News", "Web", (App.Path & "\config.ini"))
        picNews.Visible = False
        webNews.Visible = True
        optWeb.Value = True
        optIni.Value = False
        webNews.Navigate "www.yoursite.com/news.php"
    End If
```
And in event click of optIni, add:

```
    If picNews.Visible = True Then
        Exit Sub
    Else
        Call WriteINI("CONFIG", "News", "Ini", (App.Path & "\config.ini"))
        picNews.Visible = True
        webNews.Visible = False
        optWeb.Value = False
        optIni.Value = True
    End If
```
Now just miss put on config.ini, on the bottom:
```
News=Web
```
Images (I used the mode of events and news):

Just it.
Credits: HatakeAzzi

Edit:
U can use it to make news of events and more

Edit²:
I forget a thing…

Edit³:
Added some images
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...