There are 2 ways you can display a custom global message when your application loads.
I shall post the snippet's then explain what it does below
This tells VB that it is going to contact the internet
Puts Temp path as a string, inside APPdata
Checks if the file already exists, if it does it will delete it
Downloads the file, your txt file, to temppath (Application Data) as "globmsg.txt"
The part that reads the txt file, in this case "globmsg.txt"
If the file is empty it skips this part, if it contains text it will display it as a message box
And then deletes the file for next time
The catch happens if it cannot download or read the txt file, if that is the case this will display
Here is the second method
This tells VB that it is going to contact the internet
Sets strin as anything
and sets WebC as a WebClient
Downloads your TXT file as a string
If the TXT file contains "message" then it will carry on
If the TXT file contains "message|Global message", it will split it after the "|"
A message box will then appear with the message displaying what is after the "|"
An example txt file to this would be
Hope You enjoyed this tutorial and i also hope it benefited you all
Thank you
Megan
I shall post the snippet's then explain what it does below
PHP Code
<?php
Imports System.Net
PHP Code
<?php
Try
Dim TempPath As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
Dim FileToDeleteelete As String
FileToDeleteelete = TempPath & "/globmsg.txt"
If System.IO.File.Exists(FileToDeleteelete) = True Then
System.IO.File.Delete(FileToDeleteelete)
End If
My.Computer.Network.DownloadFile("http://Google.com/global/message1.txt", TempPath & "/globmsg.txt")
Dim Reader As New IO.StreamReader(TempPath & "/globmsg.txt")
Dim FileContents As String = Reader.ReadToEnd
Reader.Close()
If FileContents = "" Then
Else
MsgBox(FileContents, MsgBoxStyle.Information, "Gloabl Message")
End If
If System.IO.File.Exists(FileToDeleteelete) = True Then
System.IO.File.Delete(FileToDeleteelete)
End If
Catch
MsgBox("Gobal Message Couldnt be found", MsgBoxStyle.Critical, "London Worm")
End Try
End Sub
PHP Code
<?php
Imports System.Net
This tells VB that it is going to contact the internet
PHP Code
<?php
Dim TempPath As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
Puts Temp path as a string, inside APPdata
PHP Code
<?php
Dim FileToDeleteelete As String
FileToDeleteelete = TempPath & "/globmsg.txt"
If System.IO.File.Exists(FileToDeleteelete) = True Then
System.IO.File.Delete(FileToDeleteelete)
End If
Checks if the file already exists, if it does it will delete it
PHP Code
<?php
My.Computer.Network.DownloadFile("http://Google.com/global/message1.txt", TempPath & "/globmsg.txt")
Downloads the file, your txt file, to temppath (Application Data) as "globmsg.txt"
PHP Code
<?php
Dim Reader As New IO.StreamReader(TempPath & "/globmsg.txt")
Dim FileContents As String = Reader.ReadToEnd
Reader.Close()
The part that reads the txt file, in this case "globmsg.txt"
PHP Code
<?php
If FileContents = "" Then
Else
MsgBox(FileContents, MsgBoxStyle.Information, "Gloabl Message")
End If
If the file is empty it skips this part, if it contains text it will display it as a message box
PHP Code
<?php
If System.IO.File.Exists(FileToDeleteelete) = True Then
System.IO.File.Delete(FileToDeleteelete)
End If
And then deletes the file for next time
PHP Code
<?php
MsgBox("Gobal Message Couldnt be found", MsgBoxStyle.Critical, "London Worm")
The catch happens if it cannot download or read the txt file, if that is the case this will display
Here is the second method
PHP Code
<?php
Imports System.Net
PHP Code
<?php
Dim Strin As String
Dim WebC As New WebClient
Strin = WebC.DownloadString("http://Google.com/global/message2.txt")
If Strin.Contains("message") Then
Dim Split() As String = Strin.Split("|")
MsgBox(Split(1), MsgBoxStyle.Information, "Global Message")
End If
PHP Code
<?php
Imports System.Net
This tells VB that it is going to contact the internet
PHP Code
<?php
Dim Strin As String
Dim WebC As New WebClient
Sets strin as anything
and sets WebC as a WebClient
PHP Code
<?php
WebC.DownloadString("http://Google.com/global/message2.txt")
Downloads your TXT file as a string
PHP Code
<?php
If Strin.Contains("message") Then
Dim Split() As String = Strin.Split("|")
MsgBox(Split(1), MsgBoxStyle.Information, "Global Message")
End If
If the TXT file contains "message" then it will carry on
If the TXT file contains "message|Global message", it will split it after the "|"
A message box will then appear with the message displaying what is after the "|"
An example txt file to this would be
Code
message|Welcome to London Worm V2.1
Please read the detailed about me for more informationHope You enjoyed this tutorial and i also hope it benefited you all
Thank you
Megan


![[Image: tqE7M8d.png]](https://i.imgur.com/tqE7M8d.png)