VB6 - Event, Property Let and '\' - how to code this in c#?

C

Chua Wen Ching

Hi there.

I had 3 questions to ask.

1)

Public Event ButtonClicked(MessageBoxNumber As Integer,
OKButton As Boolean, CancelButton As Boolean, ExitButton
As Boolean)

--> how to code this in c#? If not mistaken, if they used
the keyword WithEvent i will use delegates and events. But
now is the keyword event! Any sample codes base on top?

2)

Public Property Let MessageBoxPrompt(MessageBoxNumber As
Integer, ByVal vData As String)
MBox(MessageBoxNumber).Prompt = vData
End Property

MBox is a type of MessageBox

--> oh okay, i know c# got get and set, but there is no
let. And can i assign property with arguments like
MessageBoxNumber as integer, etc...

3) in vb6, you had in operator '\' for division integer,
how can i achieve this in c#?

Any help, please?

Thanks.

Regards,
Chua Wen Ching :p
 
R

Rob Teixeira [MVP]

Chua Wen Ching said:
Hi there.

I had 3 questions to ask.

1)

Public Event ButtonClicked(MessageBoxNumber As Integer,
OKButton As Boolean, CancelButton As Boolean, ExitButton
As Boolean)

--> how to code this in c#? If not mistaken, if they used
the keyword WithEvent i will use delegates and events. But
now is the keyword event! Any sample codes base on top?

Look at the C# reference in the MSDN help. There is a sample there. And yes,
it can be a pain in C# compared to VB, but the next version (Whidbey) will
have features that make this a little easier in C#.
2)

Public Property Let MessageBoxPrompt(MessageBoxNumber As
Integer, ByVal vData As String)
MBox(MessageBoxNumber).Prompt = vData
End Property

MBox is a type of MessageBox

--> oh okay, i know c# got get and set, but there is no
let. And can i assign property with arguments like
MessageBoxNumber as integer, etc...

There is also no more Let or Set in VB. NET (just FYI).
In this case, you need to set a parameter in a string property. The closest
you're going to get is a C# indexer. I'm still ranting about this ;-)
Look up Indexer in the C# reference for a sample.
3) in vb6, you had in operator '\' for division integer,
how can i achieve this in c#?

C# division does what you want with the default division operator.

-Rob [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top