Visual Studio .net 2003

PC Software. Anything to do with PC Games & software!

Visual Studio .net 2003

Postby Jared » Wed Mar 02, 2005 10:25 pm

OK so I'm trying to write a program in visual studio dot net 2003.

this program isn't too difficult and the isntructor says we should try and use the substring method to pull out specific sequences of characters.

for our program we are taking arabic numbers and turning them into roman numerals....

so for this program we want to evaluate the first character, and then assign a new variable whatever roman letter means the same...

according to the help info, and the prof you have a variable Variable1 in this example....we are supposed to be able to say the following...

variable1.substring(0,1)

the zero and one denote the start position and the number of characters to pull out of the sequence of letters/numbers....

well my problem is whenever I try to use the substring method it comes up and gives me an error telling me that the substring method does not exist within the program.  According to the professor the substring method does not have to be called upon before use.

The only thing I'm not sure is the format the data should be in in order to use the substring method?

I've tried string (text) and double) formats with no luck...

Can anybody tell me what I'm doing wrong? I would greatly appreciate any info..;-)
User avatar
Jared
Lieutenant Colonel
Lieutenant Colonel
 
Posts: 9976
Joined: Sun Jul 13, 2003 11:18 am
Location: Uniontown, Ohio

Re: Visual Studio .net 2003

Postby krylite » Fri Mar 04, 2005 8:55 am

Do you have the header lines?:

#using
using namespace System;


I'm guessing your string object's class doesn't have that substring method.

I'm no expert on .NET, just learning it on my own(C++.NET only ) when I can.
Image
Waiting for the Queen, PMDG!
ega-GeForce FX5200 128mb DDR AGP8x
krylite
2nd Lieutenant
2nd Lieutenant
 
Posts: 89
Joined: Thu May 27, 2004 4:21 pm

Re: Visual Studio .net 2003

Postby Jared » Fri Mar 04, 2005 10:40 pm

allrighty, got it figured out, I had it converted to a string in the following manner...

me.variable1.tostring()
me.variable1.substring(0,1)

that combination does not work..

the following does though.. ;-)

me.variable1.text.tostring.substring(0,1)

lol, not sure why it likes it combined better than the other way, but it works this way.. :-)

Now on to the next problem... ;-)

I've got the first portion where we have to convert arabic to roman numbers working without a hitch with strikingly good data validation going for it.

Now the interesting part where I have to convert roman to arabic, WITH data validation...

I kind of have an idea so I'll be busy for a bit.. ;-)
User avatar
Jared
Lieutenant Colonel
Lieutenant Colonel
 
Posts: 9976
Joined: Sun Jul 13, 2003 11:18 am
Location: Uniontown, Ohio

Re: Visual Studio .net 2003

Postby gw » Tue Mar 08, 2005 12:14 am

me.variable1.tostring() converts the value of variable1 to a string and leaves it laying around so another function can use it (on the stack actually).  You haven't changed variable1, itself, to anything.  That's why me.variable1.substring(0, 1) doesn't work.

when you string it altogether as me.variable1.tostring().substring(0,1) you get better results because the output of tostring is a string, of course, and gets passed to substring.

gw
Cessna N7654 ready to copy IFR clearance to KSMF.

Cessna N7654 cleared to KSMURF as filed.
gw
2nd Lieutenant
2nd Lieutenant
 
Posts: 154
Joined: Sun Nov 23, 2003 1:15 pm

Re: Visual Studio .net 2003

Postby Ivan » Wed Mar 09, 2005 11:50 am

substring is a function, means that you'll have to assign the result to something

blabla=variable1.substring(0,1) should work
Russian planes: IL-76 (all standard length ones),  Tu-154 and Il-62, Tu-134 and [url=http://an24.uw.hu/]An-24RV[/ur
Ivan
Lieutenant Colonel
Lieutenant Colonel
 
Posts: 5805
Joined: Sun Apr 13, 2003 8:18 am
Location: The netherlands

Re: Visual Studio .net 2003

Postby Jared » Wed Mar 09, 2005 10:21 pm

allrighty, thanks for the info, perhaps more questions will be coming in future days..;-)
User avatar
Jared
Lieutenant Colonel
Lieutenant Colonel
 
Posts: 9976
Joined: Sun Jul 13, 2003 11:18 am
Location: Uniontown, Ohio


Return to Computer Games & Software

Who is online

Users browsing this forum: No registered users and 450 guests