VB single .exe file
VB single .exe file
VB single .exe file
VB single .exe file
VB single .exe file
VB single .exe file VB single .exe file VB single .exe file VB single .exe file VB single .exe file VB single .exe file VB single .exe file VB single .exe file
VB single .exe file VB single .exe file
VB single .exe file
Go Back  Xtreme Visual Basic Talk > > > VB single .exe file


Reply
 
Thread Tools Display Modes
  #1  
Old 08-24-2013, 04:46 AM
Volnix Volnix is offline
Newcomer
 
Join Date: Feb 2009
Posts: 5
Question VB single .exe file


Hi!

I am writing a small vb programe to replace a .bat file that I had been using to start some applications.

The program I am writing starts a few programs but it also waits for a while. The code is pretty primitive but it works. I have some problems with it though so I would like to as some questions.

First of all this is the code:

Code:
Public Class Form1
This is the sub that I get by checking the code of the main form of the program. Unfortunately it cannot handle variables so I needed to use a label box and write some code in it for a "mouse hover" over it

    Private Sub Label1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseHover

'Basically I dont want to start running the code when I "hover" the mouse over the label box. I want it to start as soon as the application starts but I could not find an instance of "form load" or something like that to write a sub for... 

        Dim timer As Integer
'a variable that I am using for a "DIY" :D timer...

        Shell("C:\Program Files (x86)\Skype\Phone\skype.exe")
        Shell("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
        Shell("C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe")

'These are the programs that I want to start with the program, that works just fine

        timer = 17

        Do Until timer = 0

            Label1.Text = (timer).ToString
            Me.Refresh()
            System.Threading.Thread.Sleep(1000)
            timer = timer - 1
        Loop

'The timer. Basically there were a few problems with that. First of all the label box would not change its value in the display so I had to use a refresh code line. That works and now the label does show the changed value but... the whole form is flashing a bit and that makes it a bit "choppy". But with this way I did not have to add a timer object in the form.'


        Application.Exit()

    End Sub

End Class

Basically what I want to do is this:

1. First of all I want to run the timer loop before the program starts the programs. I had some problems with that, the program closed once before starting the programs but I might try it later again to move the timer loop before the programs start and see if it works.

2. This is what I wanted to ask basically. Is there a way to create this sub for the instance of just loading the programe without needing to "hover" the mouse over the label box to start? What would be the code for such a sub? I am using VB10.

3. Anybody know why the labelbox is not refreshing by it self? Does it have anything to do with me changing the fonts colors etc? I would like to remove the "refresh" line because its makes the whole window "flashing".

Thanks.

...and if anybody has a nice countdown timer that I can use to update the labelbox and create a countdown timer in the form I would be happy to hear it!

Last edited by Flyguy; 08-24-2013 at 10:38 AM.
Reply With Quote
  #2  
Old 08-27-2013, 04:42 AM
DrPunk's Avatar
DrPunkVB single .exe file DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

Use the Timer control that should be available in your controls Toolbox.

Set the interval to 1000 milliseconds, so it ticks every second.

The Form Load event will enable the timer, that gets the timer ticking.

In the timer Tick event you'd disable the timer, increment a variable to indicate how many seconds have passed. You can update a label with the incremented value too, if you wanted, no threading issues.

You then check your increment variable is at a particular value (17 in your case). If it's 17 then you start your programs and close the form (Me.Close, not Application.Exit). If it's not then you enable the timer again.

If you do that then you shouldn't have ANY of the problems you are facing at the moment.
__________________
There are no computers in heaven!
Reply With Quote
  #3  
Old 11-01-2013, 07:18 AM
Volnix Volnix is offline
Newcomer
 
Join Date: Feb 2009
Posts: 5
Default

Hi!

Thanks for the reply... I did not get an email notification so I just checked it...

The programs works fine now, even without the "me.exit" and just "application.end" and it also runs smoothly in terms of graphics.

I tried to add a floating image on the form with which I am having a bit of a problem not "flashing" a whine border background everytime it moves around but I am gonna start a nwe thread about that.

Thanks again!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
VB single .exe file
VB single .exe file
VB single .exe file VB single .exe file
VB single .exe file
VB single .exe file
VB single .exe file VB single .exe file VB single .exe file VB single .exe file VB single .exe file VB single .exe file VB single .exe file
VB single .exe file
VB single .exe file
 
VB single .exe file
VB single .exe file
 
-->