Home All Groups Group Topic Archive Search About
Author
28 Nov 2006 4:20 AM
alxasa
Hi, just messing around and trying to get my feet wet with VB Express
and some code.... I've got this little program, and I am trying to
figure out how to call a function that is setup as a button (without
pressing the button, just run the function:

Somefunction()

If I just put that on a line by itself, it reads back 'declaration
expected'...... how do I run Somefunction() like a general call you
would have in javascript like <script>somejsfuntion();</script>, except
in VB???

-Angie

Author
28 Nov 2006 4:31 AM
eric.burgin
if you have a button called btnClickMe, you can call the click handler
by calling the following line of code:

btnClickMe.PerformClick



alx***@gmail.com wrote:
Show quoteHide quote
> Hi, just messing around and trying to get my feet wet with VB Express
> and some code.... I've got this little program, and I am trying to
> figure out how to call a function that is setup as a button (without
> pressing the button, just run the function:
>
> Somefunction()
>
> If I just put that on a line by itself, it reads back 'declaration
> expected'...... how do I run Somefunction() like a general call you
> would have in javascript like <script>somejsfuntion();</script>, except
> in VB???
>
> -Angie
Author
28 Nov 2006 5:23 AM
Michael C
<eric.bur***@usbank.com> wrote in message
news:1164688282.959633.216780@j44g2000cwa.googlegroups.com...
> if you have a button called btnClickMe, you can call the click handler
> by calling the following line of code:
>
> btnClickMe.PerformClick

The preferred method is to have the button click event call another
function, eg:

private sub btnClickMe_Click(...)
    DoClick()
End Sub

private sub DoClick()
   'do stuff here
End sub

then just call DoClick whenever it is needed.

Michael
Author
28 Nov 2006 7:06 AM
alxasa
Michael C wrote:
Show quoteHide quote
> <eric.bur***@usbank.com> wrote in message
> news:1164688282.959633.216780@j44g2000cwa.googlegroups.com...
> > if you have a button called btnClickMe, you can call the click handler
> > by calling the following line of code:
> >
> > btnClickMe.PerformClick
>
> The preferred method is to have the button click event call another
> function, eg:
>
> private sub btnClickMe_Click(...)
>     DoClick()
> End Sub
>
> private sub DoClick()
>    'do stuff here
> End sub
>
> then just call DoClick whenever it is needed.
>
> Michael

Ah, I see :), now so I have this all straight, if I just wanted to run
the DoClick() sub, how is it called properly?  If there is a sub like
DoClick() and I want to run in the first part of the program, how would
that be setup?
Author
28 Nov 2006 7:39 AM
RobinS
If it's in a form, you could run it in the Form_Load event:

    DoClick()

Robin S.
---------------------------------------------
<alx***@gmail.com> wrote in message
Show quoteHide quote
news:1164697597.698085.25240@j44g2000cwa.googlegroups.com...
>
> Michael C wrote:
>> <eric.bur***@usbank.com> wrote in message
>> news:1164688282.959633.216780@j44g2000cwa.googlegroups.com...
>> > if you have a button called btnClickMe, you can call the click handler
>> > by calling the following line of code:
>> >
>> > btnClickMe.PerformClick
>>
>> The preferred method is to have the button click event call another
>> function, eg:
>>
>> private sub btnClickMe_Click(...)
>>     DoClick()
>> End Sub
>>
>> private sub DoClick()
>>    'do stuff here
>> End sub
>>
>> then just call DoClick whenever it is needed.
>>
>> Michael
>
> Ah, I see :), now so I have this all straight, if I just wanted to run
> the DoClick() sub, how is it called properly?  If there is a sub like
> DoClick() and I want to run in the first part of the program, how would
> that be setup?
>
Author
28 Nov 2006 7:21 PM
alxasa
Robin, sorry for my newbieness.... but could you please show which
steps/tabs, where and how you would place that?
Author
28 Nov 2006 9:46 PM
RobinS
I'm assuming that you have a form.

With the form open in design mode, double-click on
a gray area somewhere. It will bring you to the code-behind,
and add a Form_Load event.

In this procedure, put the call to the DoClick() method.
It will look like this if you click on the right thing.

Private Sub myForm_Load(ByVal sender as System.Object, _
  ByVal e as System.EventArgs) Handles MyBase.Load
    DoClick()
End Sub

The other thing you can do to create this event
is open your code-behind window, pull down "Form events"
on the left dropdown at the top, and pull down "Load"
on the right dropdown at the top.

Robin S.
------------------------

<alx***@gmail.com> wrote in message
Show quoteHide quote
news:1164741663.205746.51700@80g2000cwy.googlegroups.com...
> Robin, sorry for my newbieness.... but could you please show which
> steps/tabs, where and how you would place that?
>
Author
28 Nov 2006 9:47 PM
RobinS
By the way, if you're so new to VB.Net that you need help
putting code behind the form, you should race right out and
buy Tim Patrick's book, "Start to Finish VB2005". It's a
great book, and will really help you get up to speed fast.

Robin S.
---------------------------------------------
<alx***@gmail.com> wrote in message
Show quoteHide quote
news:1164741663.205746.51700@80g2000cwy.googlegroups.com...
> Robin, sorry for my newbieness.... but could you please show which
> steps/tabs, where and how you would place that?
>
Author
29 Nov 2006 12:35 AM
alxasa
RobinS wrote:
> By the way, if you're so new to VB.Net that you need help
> putting code behind the form, you should race right out and
> buy Tim Patrick's book, "Start to Finish VB2005". It's a
> great book, and will really help you get up to speed fast.
>
> Robin S.

I am usually open source, but this project have me diving into all
sorts of new technologies :)  Hopefully I can spin-up fast, and get
this done.  I hope I am not bothering you to ask, but I am modifying a
program.... and it seems the .NET VB Express tool hides code and is
tricky to understand, but I am figuring it out :)  Basically, I want to
completely turn off the form or GUI or have it not display at all, and
not appear the in the desktray/task manager --- is there a simple way
to accomplish all of these tasks?  It's a security module, and it's
been handed down through generations in this company, has ugly
interface.... so I am in a pinch to tie this up tight.  Thanks for your
time and info :))  Cheers! AmyMC
Author
29 Nov 2006 4:38 AM
Michael C
<alx***@gmail.com> wrote in message
news:1164760549.256156.169470@j44g2000cwa.googlegroups.com...
> I am usually open source, but this project have me diving into all
> sorts of new technologies :)  Hopefully I can spin-up fast, and get
> this done.  I hope I am not bothering you to ask, but I am modifying a
> program.... and it seems the .NET VB Express tool hides code and is
> tricky to understand, but I am figuring it out :)  Basically, I want to
> completely turn off the form or GUI or have it not display at all, and
> not appear the in the desktray/task manager --- is there a simple way
> to accomplish all of these tasks?  It's a security module, and it's
> been handed down through generations in this company, has ugly
> interface.... so I am in a pinch to tie this up tight.  Thanks for your
> time and info :))  Cheers! AmyMC

You work for a company as a programmer and you're asking how to call a
function?

Michael
Author
29 Nov 2006 5:46 AM
RobinS
<alx***@gmail.com> wrote in message
Show quoteHide quote
news:1164760549.256156.169470@j44g2000cwa.googlegroups.com...
>
> RobinS wrote:
>> By the way, if you're so new to VB.Net that you need help
>> putting code behind the form, you should race right out and
>> buy Tim Patrick's book, "Start to Finish VB2005". It's a
>> great book, and will really help you get up to speed fast.
>>
>> Robin S.
>
> I am usually open source, but this project have me diving into all
> sorts of new technologies :)  Hopefully I can spin-up fast, and get
> this done.  I hope I am not bothering you to ask, but I am modifying a
> program.... and it seems the .NET VB Express tool hides code and is
> tricky to understand, but I am figuring it out :)  Basically, I want to
> completely turn off the form or GUI or have it not display at all, and
> not appear the in the desktray/task manager --- is there a simple way
> to accomplish all of these tasks?  It's a security module, and it's
> been handed down through generations in this company, has ugly
> interface.... so I am in a pinch to tie this up tight.  Thanks for your
> time and info :))  Cheers! AmyMC
>

I don't know of a simple way to accomplish that. You
seem to want something that will run in the background,
but not show up in the task manager or the system tray.
The only way I know of to do that is to run as a Windows
service.  I don't have any experience at that, so I can't
help you.

Anyone else have an idea how Alxasa can accomplish this?
Am I right that it has to be a windows service?

Robin S.
Author
29 Nov 2006 6:52 AM
Michael C
"RobinS" <RobinS@NoSpam.yah.none> wrote in message
news:yYadnaO9tKxag_DYnZ2dnUVZ_uCdnZ2d@comcast.com...
> I don't know of a simple way to accomplish that. You
> seem to want something that will run in the background,
> but not show up in the task manager or the system tray.
> The only way I know of to do that is to run as a Windows
> service.  I don't have any experience at that, so I can't
> help you.
>
> Anyone else have an idea how Alxasa can accomplish this?
> Am I right that it has to be a windows service?

Creating services in dot net is quite easy. A service is just an exe that
always runs (if set to autostart) whether users are logged on or not. If
this is what the OP wants then a service is appropriate. The taskbar icon
and services are not necessarily related. Generally when a service, such as
sqlserver, shows a taskbar icon it is a seperate exe that controls the
service and can be run or closed independant of the service.

Michael
Author
29 Nov 2006 8:14 AM
alxasa
Great, a half-way working option for me would be to somehow hide the
GUI, can that be done programatically? :)  Thank you for your help
earlier, it did clear up my learning curve with VB.NET EXPRESS.
Someone in this thread actually asked me a loaded question about my
knowledge and position as a programmer?  Thanks for not speeding
through my emails and responding like a true professional! :)  Best
regards, A.
Author
29 Nov 2006 6:06 AM
Lucian Wischik
alx***@gmail.com wrote:
>tricky to understand, but I am figuring it out :)  Basically, I want to
>completely turn off the form or GUI or have it not display at all, and
>not appear the in the desktray/task manager --- is there a simple way
>to accomplish all of these tasks?

To prevent it appear in the task-manager's PROCESSES list is something
I don't know. But preventing it from appearing in the taskbar and the
task-managers APPLICATIONS list is a common thing in Windows. In win32
world you do it with the WS_EX_TOOLWINDOW window style. I don't know
enough about VB to tell you how it exposes this style.

--
Lucian
Author
29 Nov 2006 8:15 AM
alxasa
WS_EX_TOOLWINDOW - sounds like a start to what I want to do.  Can
anyone expand on this from Lucian? :)
Author
29 Nov 2006 4:20 PM
RobinS
Have you tried searching Google and/or MSDN?

Robin S.
------------------------
<alx***@gmail.com> wrote in message
Show quoteHide quote
news:1164788147.766732.75590@14g2000cws.googlegroups.com...
> WS_EX_TOOLWINDOW - sounds like a start to what I want to do.  Can
> anyone expand on this from Lucian? :)
>
Author
29 Nov 2006 7:01 PM
alxasa
RobinS wrote:
> Have you tried searching Google and/or MSDN?
>
> Robin S.
> ------------------------
> <alx***@gmail.com> wrote in message
> news:1164788147.766732.75590@14g2000cws.googlegroups.com...
> > WS_EX_TOOLWINDOW - sounds like a start to what I want to do.  Can
> > anyone expand on this from Lucian? :)
> >

:))) Not yet, but I did look up my question and didn't see any newbie
versions out there, but I will keep looking and hopefully someone on
here knows more than I do! ;)  I hope I am smarter this time next year
with this dev. app.  I am pretty good, but not with the syntax and
unique situations with Microsoft products.
Author
29 Nov 2006 4:23 AM
Cor Ligthert [MVP]
Alaxasas,

I never do it anymore as told in this thread, so therefore my method.

If you want to do a click event than I do.

TheClickEvent(me, nothing)

The bad thing from the btn.performclick is that the button has to be visible
at the moment you do that.

Creating extra methods has been for me never been a benefit.

Cor

<alx***@gmail.com> schreef in bericht
Show quoteHide quote
news:1164741663.205746.51700@80g2000cwy.googlegroups.com...
> Robin, sorry for my newbieness.... but could you please show which
> steps/tabs, where and how you would place that?
>