ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Console.Writeline output in VSTO (https://www.excelbanter.com/excel-programming/414834-console-writeline-output-vsto.html)

Ed White

Console.Writeline output in VSTO
 
When writing VB.Net code in VSTO, I've used Debug.Print and
Console.Writeline, but the output does not appear in the Output window.
Where do I find the output?
--
Ed

Jialiang Ge [MSFT]

Console.Writeline output in VSTO
 
Hello Ed,

Console.WriteLine does not have output because it requires a console for
the standard I/O.

Debug.Print: Please make sure that "Debug" is selected in the "Show output
from" list of the Output window. A simple test of Debug.Print in VSTO works
on my side. Ed, if this suggestion does not help you, would you please tell
me your VS version and some code snippet. I will try to reproduce the
symptom after I get these information. Thanks.

Regards,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Ed White

Console.Writeline output in VSTO
 
I'm running VS 2008 with Excel 2007.

Perhaps I need to clarify my question. When I'm running VSTO directly
inside of Visual Studio (as opposed to opening up the Excel solution outside
of VS), and I use Console.Writeline in my code, VS does in fact have a
Console output window, and Console.Writeline from a normal VB program running
inside of VS does write the output to the Console window. However, when I
try this from VB code in VSTO
Console.Writeline("This is a test")
I don't get any output anywhere.

To test the above, create an Excel Worksheet VSTO solution, add a button
(Button1) to the Excel spreadsheet, and Add Code the the buttion for the
Button1 Click event handler that simply says
Console.Writeline("Button1 was clicked") : Stop
Then run the solution from VS (e.g. hit F5), and click Button1. The program
should stop at the Stop statement (confirming the previous code was
executed). However, the "Button1 was clicked" does not show up anywhere that
I looked, including VS's Console, Immediate, and Command windows.
(Obviously, if I run open the Excel file outside of VS, I wouldn't expect any
output--I would like it inside of VS for debugging purposes.)

As for you comment on Debug.Print, I don't understand where to make the menu
selection you suggested. Under VS's View menu, there is no option for
"Debug". Under VBA, Debug.Print will in fact print to the VBA Immediate
window (that works fine on my system), but I'm not writing VBA, I'm writing
VB in VSTO.


--
Ed


""Jialiang Ge [MSFT]"" wrote:

Hello Ed,

Console.WriteLine does not have output because it requires a console for
the standard I/O.

Debug.Print: Please make sure that "Debug" is selected in the "Show output
from" list of the Output window. A simple test of Debug.Print in VSTO works
on my side. Ed, if this suggestion does not help you, would you please tell
me your VS version and some code snippet. I will try to reproduce the
symptom after I get these information. Thanks.

Regards,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



Jialiang Ge [MSFT]

Console.Writeline output in VSTO
 
Hello Ed,

1. Debug.Print

I meant the window at VS-View-Output or VS-Debug-Windows-Output by
"Output Window".

You said that by no mean could you find the output of Debug.Print, would
you please check whether the current build mode is set to "Debug" (To
better illustrate it, I have sent an email to you with the screenshot)? Is
the "DEBUG" constant defined in the build option? Debug.Print outputs the
content to the Output Window as long as we are in Debug mode and the
"DEBUG" constant is defined.

2. Console.WriteLine

Console.Write outputs the content to the standard IO. You can see the
output in the "Console Window" of a normal Winform project, because the
Winform package helps us to redirect the content to the window. But for
VSTO, the VSTO package did not do it because the VSTO designers believe
Debug.Print is functional enough for the purpose.

If you have any other questions or concerns, please DON'T hesitate to tell
me.

Regards,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================


Ed White

Console.Writeline output in VSTO
 
Thanks very much for this response. I tried it, and it works, except the
Debug.Print does not output to the Output window, it outputs to VSs
Immediate window on my PC.
--
Ed


""Jialiang Ge [MSFT]"" wrote:

Hello Ed,

1. Debug.Print

I meant the window at VS-View-Output or VS-Debug-Windows-Output by
"Output Window".

You said that by no mean could you find the output of Debug.Print, would
you please check whether the current build mode is set to "Debug" (To
better illustrate it, I have sent an email to you with the screenshot)? Is
the "DEBUG" constant defined in the build option? Debug.Print outputs the
content to the Output Window as long as we are in Debug mode and the
"DEBUG" constant is defined.

2. Console.WriteLine

Console.Write outputs the content to the standard IO. You can see the
output in the "Console Window" of a normal Winform project, because the
Winform package helps us to redirect the content to the window. But for
VSTO, the VSTO package did not do it because the VSTO designers believe
Debug.Print is functional enough for the purpose.

If you have any other questions or concerns, please DON'T hesitate to tell
me.

Regards,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================




All times are GMT +1. The time now is 02:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com