boyesjs03 Posted February 17, 2013 Author Share Posted February 17, 2013 So this is my first tutorial, and Im doing it for my 100th post xD This tutorial will show you how to add a piece of code that checks if the sever is online then shows the appropriate picture ( Online or Offline ). This is fairly basic and can teach those new to vb some basic stuff.Lets Start.All Client Side.On frmMain add a timer with these properties.Timer Name: tmrStatusTop: 0Left: 0Interval: 1000Then double click the timer and add this code inside the Sub:```If ConnectToServer(1) ThenPicOnline.Visible = TruePicOffline.Visible = FalseElsePicOnline.Visible = FalsePicOffline.Visible = TrueEnd If```Then we need to head over to Mod generals and add the file directories for the pictures.Find 'Menu pics And add```frmMenu.PicOnline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Offline.jpgfrmMenu.PicOffline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Offline.jpg```To the bottom.All you need to do now is create two picture boxes somewhere on your frmMenu with these pictures "Online" and "Offline" and set their visibility to false in properties and create the actual pictures themselves in gui/menu and name them appropriately.Im pretty sure thats everything, please let me know if ive mistyped something important ect ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) Link to comment Share on other sites More sharing options...
Matt Posted February 18, 2013 Share Posted February 18, 2013 > ```> > PicOnline.Picture = /graphics/gui/menu/Online.jpeg> > PicOffline.Picture = /graphics/gui/menu/Offline.jpeg> > ```Unless I'm mistaken, the directory you're providing will result in an error. I'm fairly confident you need to change it to```App.path & "/graphics/gui/menu/Offline.jpeg"```Otherwise, its a good and simple tutorial! I look forward to seeing more from you! Link to comment Share on other sites More sharing options...
YodoMaz Posted February 18, 2013 Share Posted February 18, 2013 it should look like this:```PicOnline.Picture = "\data files\graphics\gui\menu\Online.jpeg"PicOffline.Picture = "\data files\graphics\gui\menu\Offline.jpeg"``` Link to comment Share on other sites More sharing options...
boyesjs03 Posted February 18, 2013 Author Share Posted February 18, 2013 Sorry, I did this off the top of my head: it should look like this.```frmMenu.PicOnline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Offline.jpgfrmMenu.PicOffline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Offline.jpg```Will fix this in main post. Link to comment Share on other sites More sharing options...
abhi2011 Posted February 18, 2013 Share Posted February 18, 2013 Nice.Isn't there a tutorial for this already? Link to comment Share on other sites More sharing options...
boyesjs03 Posted February 18, 2013 Author Share Posted February 18, 2013 I found one that uses labels, thought it would be nice to use pictures :-) Link to comment Share on other sites More sharing options...
abhi2011 Posted February 19, 2013 Share Posted February 19, 2013 Oh nice. Link to comment Share on other sites More sharing options...
boyesjs03 Posted February 19, 2013 Author Share Posted February 19, 2013 Thanks ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) Link to comment Share on other sites More sharing options...
Scratso Posted March 23, 2014 Share Posted March 23, 2014 > So this is my first tutorial, and Im doing it for my 100th post xD This tutorial will show you how to add a piece of code that checks if the sever is online then shows the appropriate picture ( Online or Offline ). This is fairly basic and can teach those new to vb some basic stuff.> > Lets Start.> > All Client Side.> > On frmMain add a timer with these properties.> > Timer Name: tmrStatus> > Top: 0> > Left: 0> > Interval: 1000> > Then double click the timer and add this code inside the Sub:> > > > ```> If ConnectToServer(1) Then PicOnline.Visible = True PicOffline.Visible = False Else PicOnline.Visible = False PicOffline.Visible = True End If> ```> Then we need to head over to Mod generals and add the file directories for the pictures.> > Find 'Menu pics And add> ```> frmMenu.PicOnline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Offline.jpg > frmMenu.PicOffline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Offline.jpg> ```> To the bottom.> > All you need to do now is create two picture boxes somewhere on your frmMenu with these pictures "Online" and "Offline" and set their visibility to false in properties and create the actual pictures themselves in gui/menu and name them appropriately.> > Im pretty sure thats everything, please let me know if ive mistyped something important ect ![](http://www.touchofdeathforums.com/community/public/style_emoticons/default/smile.png)Shouldn't the online pic be this:```frmMenu.PicOnline.Picture = LoadPicture(App.Path & "\data files\graphics\gui\menu\Online.jpg")```? otherwise it's displaying that the server is offline even when the server is online… Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now