473,471 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Visio events (C# to VB translation)

After looking at the sample OfficePlan in Visio 2003 SDK
I can't translate from C# to VB the following statements:

newEvent = documentEvents.AddAdvise(
unchecked((short)VisEventCodes.visEvtAdd) +
(short)VisEventCodes.visEvtShape),
(IVisEventProc)this, sink, targetArgs);

and the corresponding ones:

case (short)VisEventCodes.visEvtShape +
unchecked((short)VisEventCodes.visEvtAdd):

where:
VisEventCodes.visEvtShape = 64
but
VisEventCodes.visEvtAdd = 32768

Thanks,
Sorin-Emanuel

Nov 21 '05 #1
2 3442
There is no direct equivalent to "unchecked" in VB.
Just do a conversion, leaving it out. You may need to adjust the type of
visEvtAdd to an integer. (download our demo at www.instantvb.com for the
conversion).
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant J#: VB.NET to J# Converter
Clear VB: Cleans up outdated VB.NET code
"Sorin-Emanuel" wrote:
After looking at the sample OfficePlan in Visio 2003 SDK
I can't translate from C# to VB the following statements:

newEvent = documentEvents.AddAdvise(
unchecked((short)VisEventCodes.visEvtAdd) +
(short)VisEventCodes.visEvtShape),
(IVisEventProc)this, sink, targetArgs);

and the corresponding ones:

case (short)VisEventCodes.visEvtShape +
unchecked((short)VisEventCodes.visEvtAdd):

where:
VisEventCodes.visEvtShape = 64
but
VisEventCodes.visEvtAdd = 32768

Thanks,
Sorin-Emanuel

Nov 21 '05 #2
Your demo at www.instantvb.com might be useful sometimes.
In this case the solution proposed:

'TODO: INSTANT VB TODO TASK: There is no VB.NET equivalent to
'unchecked':
'ORIGINAL LINE: newEvent =
documentEvents.AddAdvise(unchecked((short)VisEvent Codes.visEvtAdd) +
(short)VisEventCodes.visEvtShape), (IVisEventProc)Me, sink,
targetArgs);
Private newEvent =
documentEvents.AddAdvise((CShort(VisEventCodes.vis EvtAdd)) +
CShort(VisEventCodes.visEvtShape)), CType(Me, IVisEventProc), sink,
targetArgs)

'TODO: INSTANT VB TODO TASK: There is no VB.NET equivalent to
'unchecked':
'ORIGINAL LINE: case (short)VisEventCodes.visEvtShape +
unchecked((short)VisEventCodes.visEvtAdd):
Case CShort(VisEventCodes.visEvtShape) +
(CShort(VisEventCodes.visEvtAdd))

raise the error:
"Constant expression (VisEventCodes.visEvtAdd) not representable in
type 'Short'"

And AddAdwise:
evtObj = object.AddAdvise (eventCode, eventSink, IIDSink, targetArgs)
needs an eventCode (Short integer).

I am looking for a refinement of this idea.

--

Sorin

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stefan Svensson | last post by:
I posted this request for help in Visio, troubleshooting newsgroup and Installation newsgroup, about 1,5 months ago but without result. "I recently installed Visio .NET Enterprise Architect 2003...
1
by: jessprev | last post by:
Hello, I have a database with customer information. I would like to add a button that will dynamically open a visio diagram of their network based on the customer name. For example if ABCCo...
4
by: Mike Logan | last post by:
I would like to dynamically create a Visio diagram from .Net. I tried looking at the Visio SDK, but the samples are extremely convoluted for me to understand. Does someone have an example of...
2
by: Dominic | last post by:
I try to use Visio filter but it needs to install by using installation package from Microsoft. If I need to use only DLL for extract text from vsd with my application, how can I do? I need...
1
by: =?Utf-8?B?SkFXQUFIQVI=?= | last post by:
i just wanted to hide visio stencil blocks from my parent form. in child form i used thie following code to hide....
14
by: joemo2003 | last post by:
I created a button in excel sheet, and that button need to browse and open a visio drawing. I try two ways to do it, but either way work. can anyone help? First way: Private Sub...
5
by: cmk128 | last post by:
Hi I need to create a website, the function of the web should near microsoft visio. Please tell me what php library can let me to create a sharp on the web, and able to drag it and put a line to...
0
by: frederick.the.fool | last post by:
I'm writing a project that does Visio automation. I'm writing it in C+ +/CLI because it needs to reference a good amount of native C++ code. One way to call the Visio API, of course, is to use...
0
by: theCoder7 | last post by:
Hi Everybody, I want to capture the visio window close event. Whenever i click 'X' i want to capture, what has been internally done by the Visio. Actually i want to override that event so that after...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.