By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,446 Members | 2,998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,446 IT Pros & Developers. It's quick & easy.

Run code from IDE

P: n/a
How can i run a bit of code straight from the IDE? Right now i make a
temporary button and put the code behind that, then i run debug mode
and click on the button. Is there a way to highlight some code and
tell it to run that? Is there a "scratchpad" type window like in VBA
where I can write some simple code to be executed? Thanks for the help
in advance

Apr 8 '06 #1
Share this Question
Share on Google+
19 Replies


P: n/a
In debug mode you can write and execute in immediate window

"Bryan" <br*******@gmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
How can i run a bit of code straight from the IDE? Right now i make a
temporary button and put the code behind that, then i run debug mode
and click on the button. Is there a way to highlight some code and
tell it to run that? Is there a "scratchpad" type window like in VBA
where I can write some simple code to be executed? Thanks for the help
in advance

Apr 8 '06 #2

P: n/a
This is quite limited, for example you cannot declare variables.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"Carl-Johan Wik" <cj***@hotmail.com> wrote in message
news:eg****************@TK2MSFTNGP02.phx.gbl...
In debug mode you can write and execute in immediate window

"Bryan" <br*******@gmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
How can i run a bit of code straight from the IDE? Right now i make a
temporary button and put the code behind that, then i run debug mode
and click on the button. Is there a way to highlight some code and
tell it to run that? Is there a "scratchpad" type window like in VBA
where I can write some simple code to be executed? Thanks for the help
in advance


Apr 8 '06 #3

P: n/a
I wish there was a way to run a single sub or function, or even to open
a form without having to set it as the default start up form. Maybe I
am missing something When you guys want to test little things or run a
little maintenece procedure, what do you do?

Apr 8 '06 #4

P: n/a
OK, well just because you are writing a windows applications it doesent mean
you need a user interface. You can remove the form and use a sub main in a
module. you can put your code in there.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"Bryan" <br*******@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
I wish there was a way to run a single sub or function, or even to open
a form without having to set it as the default start up form. Maybe I
am missing something When you guys want to test little things or run a
little maintenece procedure, what do you do?

Apr 8 '06 #5

P: n/a
Bryan,

I just open them as form, keep the default name and clean all with those
default names up time by time.

:-)

Cor
Apr 8 '06 #6

P: n/a
This article of mine may help you:
http://www.vbdocman.com/blog/archives/21

--
Peter Macej
Helixoft - http://www.vbdocman.com
VBdocman - Automatic generator of technical documentation for VB, VB
..NET and ASP .NET code
Apr 8 '06 #7

P: n/a
|I read your article, but without being rude in any way, I dont see that
your methods in step 3 or 4 are functionally any different from what you say
is cumbersome in step 1. In fact I think its more cumbersome and has no
particular advantage wrt trying out a snippet of code.

Things changed with the advent of .NET and people are just going to have to
get over it. In all honesty when you are writing code everyday for seven
hours a day, you get better at preventing compiler or runtime failures and
its not such an issue.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"Peter Macej" <pe***@vbdocman.com> wrote in message
news:OB**************@TK2MSFTNGP03.phx.gbl...
This article of mine may help you:
http://www.vbdocman.com/blog/archives/21

--
Peter Macej
Helixoft - http://www.vbdocman.com
VBdocman - Automatic generator of technical documentation for VB, VB .NET
and ASP .NET code

Apr 8 '06 #8

P: n/a

"Bryan" <br*******@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
I wish there was a way to run a single sub or function, or even to open
a form without having to set it as the default start up form. Maybe I
am missing something When you guys want to test little things or run a
little maintenece procedure, what do you do?


I put it in a button click event or in form load.

Apr 8 '06 #9

P: n/a
> |I read your article, but without being rude in any way, I dont see that
your methods in step 3 or 4 are functionally any different from what you say
is cumbersome in step 1. In fact I think its more cumbersome and has no
particular advantage wrt trying out a snippet of code.


My experience is this:
The project I'm working on takes about 10 seconds to compile and about
30 seconds to start. This is 40 seconds. Just to see whether, for
example some regular expression I wrote is correct. Opening Snipped
Editor, pasting two lines of code and executing takes me about 10
seconds. With macro IDE it is even faster.
--
Peter Macej
Helixoft - http://www.vbdocman.com
VBdocman - Automatic generator of technical documentation for VB, VB
..NET and ASP .NET code
Apr 8 '06 #10

P: n/a
40 seconds is a long time, I think perhaps you may want to think about
compiling some of your code into libararies as this is way too long.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"Peter Macej" <pe***@vbdocman.com> wrote in message
news:OO**************@TK2MSFTNGP03.phx.gbl...
|I read your article, but without being rude in any way, I dont see that
your methods in step 3 or 4 are functionally any different from what you
say is cumbersome in step 1. In fact I think its more cumbersome and has
no particular advantage wrt trying out a snippet of code.


My experience is this:
The project I'm working on takes about 10 seconds to compile and about 30
seconds to start. This is 40 seconds. Just to see whether, for example
some regular expression I wrote is correct. Opening Snipped Editor,
pasting two lines of code and executing takes me about 10 seconds. With
macro IDE it is even faster.
--
Peter Macej
Helixoft - http://www.vbdocman.com
VBdocman - Automatic generator of technical documentation for VB, VB .NET
and ASP .NET code

Apr 8 '06 #11

P: n/a
> 40 seconds is a long time, I think perhaps you may want to think about
compiling some of your code into libararies as this is way too long.


Yes. The project is DLL (VS add-in) and most of the start time takes
launching of another VS instance which is DLL's host. I agree that with
normal programs this is not an issue.
--
Peter Macej
Helixoft - http://www.vbdocman.com
VBdocman - Automatic generator of technical documentation for VB, VB
..NET and ASP .NET code
Apr 8 '06 #12

P: n/a
Create a public sub in a module and you can call it from the Immediate
window. Paste codes you need to test there.

"Bryan" <br*******@gmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
How can i run a bit of code straight from the IDE? Right now i make a
temporary button and put the code behind that, then i run debug mode
and click on the button. Is there a way to highlight some code and
tell it to run that? Is there a "scratchpad" type window like in VBA
where I can write some simple code to be executed? Thanks for the help
in advance

Apr 9 '06 #13

P: n/a
How does this help ?, the code in the module has still to be compiled.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net

"+Vice" <to******@earthlink.net> wrote in message
news:ug****************@TK2MSFTNGP02.phx.gbl...
Create a public sub in a module and you can call it from the Immediate
window. Paste codes you need to test there.

"Bryan" <br*******@gmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
How can i run a bit of code straight from the IDE? Right now i make a
temporary button and put the code behind that, then i run debug mode
and click on the button. Is there a way to highlight some code and
tell it to run that? Is there a "scratchpad" type window like in VBA
where I can write some simple code to be executed? Thanks for the help
in advance


Apr 9 '06 #14

P: n/a
#1 - When you run the code, the program automatically recompiles so it's
pretty transparent.
#2 - He's not stating he doesn't want to have to recompile.
#3 - How are you contributing?

"OHM ( One Handed Man )" <me@mine.com> wrote in message
news:uu**************@TK2MSFTNGP03.phx.gbl...
How does this help ?, the code in the module has still to be compiled.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net

"+Vice" <to******@earthlink.net> wrote in message
news:ug****************@TK2MSFTNGP02.phx.gbl...
Create a public sub in a module and you can call it from the Immediate
window. Paste codes you need to test there.

"Bryan" <br*******@gmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
How can i run a bit of code straight from the IDE? Right now i make a
temporary button and put the code behind that, then i run debug mode
and click on the button. Is there a way to highlight some code and
tell it to run that? Is there a "scratchpad" type window like in VBA
where I can write some simple code to be executed? Thanks for the help
in advance



Apr 9 '06 #15

P: n/a
Yes, he has implied he didnt want to recompile, if you read up he has
compared the immediate window in pre-.net basic where code was interpreted,
and if you read-up, you will see I have already contributed, and this post
is a continuation of that contribution. Compilation and load can take up to
a minute if you are writing large solutions, but perhaps you're still on
"Hello World"?

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"+Vice" <to******@earthlink.net> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
#1 - When you run the code, the program automatically recompiles so it's
pretty transparent.
#2 - He's not stating he doesn't want to have to recompile.
#3 - How are you contributing?

"OHM ( One Handed Man )" <me@mine.com> wrote in message
news:uu**************@TK2MSFTNGP03.phx.gbl...
How does this help ?, the code in the module has still to be compiled.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net

"+Vice" <to******@earthlink.net> wrote in message
news:ug****************@TK2MSFTNGP02.phx.gbl...
Create a public sub in a module and you can call it from the Immediate
window. Paste codes you need to test there.

"Bryan" <br*******@gmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
How can i run a bit of code straight from the IDE? Right now i make a
temporary button and put the code behind that, then i run debug mode
and click on the button. Is there a way to highlight some code and
tell it to run that? Is there a "scratchpad" type window like in VBA
where I can write some simple code to be executed? Thanks for the help
in advance



Apr 10 '06 #16

P: n/a
Yes I agree, you contributed with code in sub Main of a module and I suppose
your super solution doesn't require compilation? You should be writing
Hello World if you ask me.

"OHM ( One Handed Man )" <me@mine.com> wrote in message
news:u%****************@TK2MSFTNGP04.phx.gbl...
Yes, he has implied he didnt want to recompile, if you read up he has
compared the immediate window in pre-.net basic where code was
interpreted, and if you read-up, you will see I have already contributed,
and this post is a continuation of that contribution. Compilation and load
can take up to a minute if you are writing large solutions, but perhaps
you're still on "Hello World"?

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"+Vice" <to******@earthlink.net> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
#1 - When you run the code, the program automatically recompiles so it's
pretty transparent.
#2 - He's not stating he doesn't want to have to recompile.
#3 - How are you contributing?

"OHM ( One Handed Man )" <me@mine.com> wrote in message
news:uu**************@TK2MSFTNGP03.phx.gbl...
How does this help ?, the code in the module has still to be compiled.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net

"+Vice" <to******@earthlink.net> wrote in message
news:ug****************@TK2MSFTNGP02.phx.gbl...
Create a public sub in a module and you can call it from the Immediate
window. Paste codes you need to test there.

"Bryan" <br*******@gmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
> How can i run a bit of code straight from the IDE? Right now i make a
> temporary button and put the code behind that, then i run debug mode
> and click on the button. Is there a way to highlight some code and
> tell it to run that? Is there a "scratchpad" type window like in VBA
> where I can write some simple code to be executed? Thanks for the help
> in advance
>



Apr 11 '06 #17

P: n/a
>I wish there was a way to run a single sub or function, or even to open
a form without having to set it as the default start up form.
My response was accurate, you simple didnt read it.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"+Vice" <to******@earthlink.net> wrote in message
news:ei**************@TK2MSFTNGP03.phx.gbl... Yes I agree, you contributed with code in sub Main of a module and I
suppose your super solution doesn't require compilation? You should be
writing Hello World if you ask me.

"OHM ( One Handed Man )" <me@mine.com> wrote in message
news:u%****************@TK2MSFTNGP04.phx.gbl...
Yes, he has implied he didnt want to recompile, if you read up he has
compared the immediate window in pre-.net basic where code was
interpreted, and if you read-up, you will see I have already contributed,
and this post is a continuation of that contribution. Compilation and
load can take up to a minute if you are writing large solutions, but
perhaps you're still on "Hello World"?

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"+Vice" <to******@earthlink.net> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
#1 - When you run the code, the program automatically recompiles so it's
pretty transparent.
#2 - He's not stating he doesn't want to have to recompile.
#3 - How are you contributing?

"OHM ( One Handed Man )" <me@mine.com> wrote in message
news:uu**************@TK2MSFTNGP03.phx.gbl...
How does this help ?, the code in the module has still to be compiled.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net

"+Vice" <to******@earthlink.net> wrote in message
news:ug****************@TK2MSFTNGP02.phx.gbl...
> Create a public sub in a module and you can call it from the Immediate
> window. Paste codes you need to test there.
>
> "Bryan" <br*******@gmail.com> wrote in message
> news:11**********************@e56g2000cwe.googlegr oups.com...
>> How can i run a bit of code straight from the IDE? Right now i make
>> a
>> temporary button and put the code behind that, then i run debug mode
>> and click on the button. Is there a way to highlight some code and
>> tell it to run that? Is there a "scratchpad" type window like in VBA
>> where I can write some simple code to be executed? Thanks for the
>> help
>> in advance
>>
>
>



Apr 11 '06 #18

P: n/a
>>OK, well just because you are writing a windows applications it doesent
mean you need a user interface. You can remove the form and use a sub main
in a module. you can put your code in there.
That was your response but note how does that differ from mine? Try
returning something from Sub Main. As he stated, a way to run a single SUB
or FUNCTION and my solution was to create a PUBLIC SUB or FUNCTION in a
module so you can call it directly from the immediate window. And what was
your response to that? How does this help? It still needs to be compiled.
Hello World? Who didn't simply read what?
"OHM ( One Handed Man )" <me@mine.com> wrote in message
news:OG**************@TK2MSFTNGP02.phx.gbl...I wish there was a way to run a single sub or function, or even to open
a form without having to set it as the default start up form.


My response was accurate, you simple didnt read it.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"+Vice" <to******@earthlink.net> wrote in message
news:ei**************@TK2MSFTNGP03.phx.gbl...
Yes I agree, you contributed with code in sub Main of a module and I
suppose your super solution doesn't require compilation? You should be
writing Hello World if you ask me.

"OHM ( One Handed Man )" <me@mine.com> wrote in message
news:u%****************@TK2MSFTNGP04.phx.gbl...
Yes, he has implied he didnt want to recompile, if you read up he has
compared the immediate window in pre-.net basic where code was
interpreted, and if you read-up, you will see I have already
contributed, and this post is a continuation of that contribution.
Compilation and load can take up to a minute if you are writing large
solutions, but perhaps you're still on "Hello World"?

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"+Vice" <to******@earthlink.net> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
#1 - When you run the code, the program automatically recompiles so
it's pretty transparent.
#2 - He's not stating he doesn't want to have to recompile.
#3 - How are you contributing?

"OHM ( One Handed Man )" <me@mine.com> wrote in message
news:uu**************@TK2MSFTNGP03.phx.gbl...
> How does this help ?, the code in the module has still to be compiled.
>
> --
> ( OHM ) - One Handed Man
> AKA Terry Burns - http://TrainingOn.net
>
> "+Vice" <to******@earthlink.net> wrote in message
> news:ug****************@TK2MSFTNGP02.phx.gbl...
>> Create a public sub in a module and you can call it from the
>> Immediate window. Paste codes you need to test there.
>>
>> "Bryan" <br*******@gmail.com> wrote in message
>> news:11**********************@e56g2000cwe.googlegr oups.com...
>>> How can i run a bit of code straight from the IDE? Right now i make
>>> a
>>> temporary button and put the code behind that, then i run debug mode
>>> and click on the button. Is there a way to highlight some code and
>>> tell it to run that? Is there a "scratchpad" type window like in
>>> VBA
>>> where I can write some simple code to be executed? Thanks for the
>>> help
>>> in advance
>>>
>>
>>
>
>



Apr 12 '06 #19

P: n/a
As a matter of fact you although you cant return anything from a Sub, you
can alter object passed to it, but that is not the issue.

He asked two questions.

1.) Could he run a function from an immediate window.
This has been discussed to death and there is no point talking about it
further.

2.) Could he simple call a from a function ?
I wish there was a way to run a single sub or function, or even to open
a form without having to set it as the default start up form.

You can optionally run Sub Main and open up a form if required. Some windows
applications dont require a user interface so this would be appropriate in
such cases.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net

"+Vice" <to******@earthlink.net> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
OK, well just because you are writing a windows applications it doesent
mean you need a user interface. You can remove the form and use a sub
main in a module. you can put your code in there.
That was your response but note how does that differ from mine? Try
returning something from Sub Main. As he stated, a way to run a single
SUB or FUNCTION and my solution was to create a PUBLIC SUB or FUNCTION in
a module so you can call it directly from the immediate window. And what
was your response to that? How does this help? It still needs to be
compiled. Hello World? Who didn't simply read what?
"OHM ( One Handed Man )" <me@mine.com> wrote in message
news:OG**************@TK2MSFTNGP02.phx.gbl... >I wish there was a way to run a single sub or function, or even to open
a form without having to set it as the default start up form.


My response was accurate, you simple didnt read it.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"+Vice" <to******@earthlink.net> wrote in message
news:ei**************@TK2MSFTNGP03.phx.gbl...
Yes I agree, you contributed with code in sub Main of a module and I
suppose your super solution doesn't require compilation? You should be
writing Hello World if you ask me.

"OHM ( One Handed Man )" <me@mine.com> wrote in message
news:u%****************@TK2MSFTNGP04.phx.gbl...
Yes, he has implied he didnt want to recompile, if you read up he has
compared the immediate window in pre-.net basic where code was
interpreted, and if you read-up, you will see I have already
contributed, and this post is a continuation of that contribution.
Compilation and load can take up to a minute if you are writing large
solutions, but perhaps you're still on "Hello World"?

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"+Vice" <to******@earthlink.net> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
> #1 - When you run the code, the program automatically recompiles so
> it's pretty transparent.
> #2 - He's not stating he doesn't want to have to recompile.
> #3 - How are you contributing?
>
> "OHM ( One Handed Man )" <me@mine.com> wrote in message
> news:uu**************@TK2MSFTNGP03.phx.gbl...
>> How does this help ?, the code in the module has still to be
>> compiled.
>>
>> --
>> ( OHM ) - One Handed Man
>> AKA Terry Burns - http://TrainingOn.net
>>
>> "+Vice" <to******@earthlink.net> wrote in message
>> news:ug****************@TK2MSFTNGP02.phx.gbl...
>>> Create a public sub in a module and you can call it from the
>>> Immediate window. Paste codes you need to test there.
>>>
>>> "Bryan" <br*******@gmail.com> wrote in message
>>> news:11**********************@e56g2000cwe.googlegr oups.com...
>>>> How can i run a bit of code straight from the IDE? Right now i
>>>> make a
>>>> temporary button and put the code behind that, then i run debug
>>>> mode
>>>> and click on the button. Is there a way to highlight some code and
>>>> tell it to run that? Is there a "scratchpad" type window like in
>>>> VBA
>>>> where I can write some simple code to be executed? Thanks for the
>>>> help
>>>> in advance
>>>>
>>>
>>>
>>
>>
>
>



Apr 12 '06 #20

This discussion thread is closed

Replies have been disabled for this discussion.