473,503 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert from c#

hi all
how can i change this from C# to VB.NET
thsk
JSB
17: public string this[int index]
18: {
19: get
20: {
21: string tmp;
22:
23: if( index >= 0 && index <= size-1 )
24: tmp = words[index];
25: else
26: tmp = "";
27:
28: return ( tmp );
29: }
30: set
31: {
32: if( index >= 0 && index <= size-1 )
33: words[index] = value;
34: }
35: }
Nov 20 '05 #1
7 1045
* "João Santa Bárbara" <jo****@i24portugal.com> scripsit:
how can i change this from C# to VB.NET

17: public string this[int index]
18: {
19: get
20: {
21: string tmp;
22:
23: if( index >= 0 && index <= size-1 )
24: tmp = words[index];
25: else
26: tmp = "";
27:
28: return ( tmp );
29: }
30: set
31: {
32: if( index >= 0 && index <= size-1 )
33: words[index] = value;
34: }
35: }


Did you try the converters?

C# -> VB.NET Converters:

<URL:http://www.aspalliance.com/aldotnet/examples/translate.aspx>
<URL:http://www.kamalpatel.net/ConvertCSharp2VB.aspx>
<URL:http://csharpconverter.claritycon.com/>
<URL:http://www.ragingsmurf.com/vbcsharpconverter.aspx>
<URL:http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=c622348b-18a9-47d6-8687-979975d5957d>

<URL:http://www.remotesoft.com/>
-> "Octopus"

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Hi,
Public Property Myprop(ByVal index As Long) As Long
Get
Dim tmp As String
If index > 0 And index <= size - 1 Then
tmp = words(index)
Else
tmp = ""
End If
Return tmp
End Get
Set(ByVal Value As Long)
If index >= 0 And index <= size - 1 Then
words([index] = Value)
End If
End Set
End Property

Stefano
"João Santa Bárbara" <jo****@i24portugal.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
hi all
how can i change this from C# to VB.NET
thsk
JSB
17: public string this[int index]
18: {
19: get
20: {
21: string tmp;
22:
23: if( index >= 0 && index <= size-1 )
24: tmp = words[index];
25: else
26: tmp = "";
27:
28: return ( tmp );
29: }
30: set
31: {
32: if( index >= 0 && index <= size-1 )
33: words[index] = value;
34: }
35: }

Nov 20 '05 #3
Default Public Property Item(index As Integer) As String
Get
Dim tmp As String
If index >= 0 And index <= (size-1) Then
tmp = words(index)
Else
tmp = ""
End If
Return tmp
End Get
Set(value As String)
If index >= 0 And index <= (size - 1) Then
words(index) = value
End If
End Set
End Property
"João Santa Bárbara" <jo****@i24portugal.com> a écrit dans le message de
news:en**************@tk2msftngp13.phx.gbl...
hi all
how can i change this from C# to VB.NET
thsk
JSB
17: public string this[int index]
18: {
19: get
20: {
21: string tmp;
22:
23: if( index >= 0 && index <= size-1 )
24: tmp = words[index];
25: else
26: tmp = "";
27:
28: return ( tmp );
29: }
30: set
31: {
32: if( index >= 0 && index <= size-1 )
33: words[index] = value;
34: }
35: }

Nov 20 '05 #4
Stupid boy ! As Long and returning a String ????
"Stefano Galluzzo" <st**************@alfapi.com> a écrit dans le message de
news:ao******************@tornado.fastwebnet.it...
Hi,
Public Property Myprop(ByVal index As Long) As Long
Get
Dim tmp As String
If index > 0 And index <= size - 1 Then
tmp = words(index)
Else
tmp = ""
End If
Return tmp
End Get
Set(ByVal Value As Long)
If index >= 0 And index <= size - 1 Then
words([index] = Value)
End If
End Set
End Property

Stefano
"João Santa Bárbara" <jo****@i24portugal.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
hi all
how can i change this from C# to VB.NET
thsk
JSB
17: public string this[int index]
18: {
19: get
20: {
21: string tmp;
22:
23: if( index >= 0 && index <= size-1 )
24: tmp = words[index];
25: else
26: tmp = "";
27:
28: return ( tmp );
29: }
30: set
31: {
32: if( index >= 0 && index <= size-1 )
33: words[index] = value;
34: }
35: }


Nov 20 '05 #5
* "Stefano Galluzzo" <st**************@alfapi.com> scripsit:
Public Property Myprop(ByVal index As Long) As Long

^^^^
???

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
João,
Stafano was close:

Default Public Property Myprop(ByVal index As Integer) As String
Get
If index >= 0 AndAlso index <= size - 1 Then
Return words(index)
Else
Return ""
End If
End Get
Set(ByVal value As String)
If index >= 0 AndAlso index <= size - 1 Then
words(index) = value
End If
End Set
End Property

The "Default" on the property makes it behave more like the indexer. An int
in C# is an Integer in VB.NET, in that they both are aliases to
System.Int32.

I don't see that the tmp in the getter is really doing anything (adding
value), so I removed it.

I would consider throwing an IndexOutOfRangeException or
ArgumentOutOfRangeException in the getter & setter...

Hope this helps
Jay

"João Santa Bárbara" <jo****@i24portugal.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
hi all
how can i change this from C# to VB.NET
thsk
JSB
17: public string this[int index]
18: {
19: get
20: {
21: string tmp;
22:
23: if( index >= 0 && index <= size-1 )
24: tmp = words[index];
25: else
26: tmp = "";
27:
28: return ( tmp );
29: }
30: set
31: {
32: if( index >= 0 && index <= size-1 )
33: words[index] = value;
34: }
35: }

Nov 20 '05 #7
There is a tools for vb converting to c#.
http:\\www.e-iceblue.com
Nov 20 '05 #8

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

Similar topics

19
7246
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
1
1787
by: Logan X via .NET 247 | last post by:
It's official....Convert blows. I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance...
4
3600
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
7
7073
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done...
3
10241
by: Convert TextBox.Text to Int32 Problem | last post by:
Need a little help here. I saw some related posts, so here goes... I have some textboxes which are designed for the user to enter a integer value. In "old school C" we just used the atoi function...
7
29155
by: patang | last post by:
I want to convert amount to words. Is there any funciton available? Example: $230.30 Two Hundred Thirty Dollars and 30/100
4
4502
by: Edwin Knoppert | last post by:
In my code i use the text from a textbox and convert it to a double value. I was using Convert.ToDouble() but i'm used to convert comma to dot. This way i can assure the text is correct. However...
1
3567
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
6
4239
by: Ken Fine | last post by:
This is a basic question. What is the difference between casting and using the Convert.ToXXX methods, from the standpoint of the compiler, in terms of performance, and in other ways? e.g. ...
0
10706
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
7084
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
7278
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,...
1
6991
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
5578
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
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
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
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
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
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.