Click here to Skip to main content
15,908,254 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to classify the content of textbox Pin
Wendelius19-Oct-08 9:07
mentorWendelius19-Oct-08 9:07 
GeneralRe: how to classify the content of textbox Pin
lolla200619-Oct-08 10:46
lolla200619-Oct-08 10:46 
GeneralRe: how to classify the content of textbox Pin
Guffa19-Oct-08 15:33
Guffa19-Oct-08 15:33 
GeneralRe: how to classify the content of textbox Pin
lolla200622-Oct-08 7:14
lolla200622-Oct-08 7:14 
GeneralRe: how to classify the content of textbox Pin
Guffa22-Oct-08 22:05
Guffa22-Oct-08 22:05 
GeneralRe: how to classify the content of textbox Pin
Wendelius19-Oct-08 18:00
mentorWendelius19-Oct-08 18:00 
GeneralRe: how to classify the content of textbox Pin
lolla200622-Oct-08 7:17
lolla200622-Oct-08 7:17 
GeneralRe: how to classify the content of textbox Pin
Wendelius22-Oct-08 8:46
mentorWendelius22-Oct-08 8:46 
For the compiler error: the words was only a variable name. In your case use the variable where you have the original string you want to split.

And then the logic (since this seems to be a homework assignment I won't go to full blown solution). One (brute force) way to handle this could be:
- create a class that holds information about the input string, number and operation (three separate properties)
- create a generic list for this type where you will store individual 'elements'
- break the operations one by one into parts and add them to the list to the place where you parsed them.

Something like following (let's say the class name is Operation:

First you have only one Operation instance in the list, which has three properties
1: text: 22+35-76+28*5, number: empty, operation: empty

if you split the text using plus, you could then have three instances on the list
1: text: empty, number: 22 operation: +
2: text: 35-76, number: empty, operation: +
3: text: 28*5, number: empty, operation: empty

then if you split using minus you could have four instances (note the order)
1: text: empty, number: 22 operation: +
2: text: empty, number: 35, operation: -
3: text: empty, number: 76, operation: +
4: text: 28*5, number: empty, operation: empty

and so on.

This won't entirely solve the issue you have, but perhaps gets you forward.

The need to optimize rises from a bad design.

My articles[^]

QuestionSimple case statement looking for Enter key Pin
Brad Wick19-Oct-08 8:22
Brad Wick19-Oct-08 8:22 
AnswerRe: Simple case statement looking for Enter key Pin
Wendelius19-Oct-08 9:14
mentorWendelius19-Oct-08 9:14 
AnswerRe: Simple case statement looking for Enter key Pin
PIEBALDconsult19-Oct-08 15:53
mvePIEBALDconsult19-Oct-08 15:53 
QuestionInsert DataTable to Database. Pin
hdv21219-Oct-08 8:02
hdv21219-Oct-08 8:02 
AnswerRe: Insert DataTable to Database. Pin
Mycroft Holmes19-Oct-08 12:35
professionalMycroft Holmes19-Oct-08 12:35 
QuestionC# CreateHandle Exceptions Pin
ewan19-Oct-08 7:54
ewan19-Oct-08 7:54 
AnswerRe: C# CreateHandle Exceptions Pin
N a v a n e e t h19-Oct-08 18:03
N a v a n e e t h19-Oct-08 18:03 
QuestionHow can I read out the process-name via a mouse click? Pin
MyPiano19-Oct-08 6:44
MyPiano19-Oct-08 6:44 
AnswerRe: How can I read out the process-name via a mouse click? Pin
GLLNS19-Oct-08 14:03
GLLNS19-Oct-08 14:03 
GeneralRe: How can I read out the process-name via a mouse click? Pin
MyPiano20-Oct-08 3:33
MyPiano20-Oct-08 3:33 
QuestionConnection String from Solution Explorer. [modified] Pin
new2pgrmg19-Oct-08 6:25
new2pgrmg19-Oct-08 6:25 
GeneralRe: Connection String from Solution Explorer. Pin
Guffa19-Oct-08 6:32
Guffa19-Oct-08 6:32 
GeneralRe: Connection String from Solution Explorer. Pin
new2pgrmg19-Oct-08 7:24
new2pgrmg19-Oct-08 7:24 
GeneralRe: Connection String from Solution Explorer. Pin
Guffa19-Oct-08 9:45
Guffa19-Oct-08 9:45 
GeneralRe: Connection String from Solution Explorer. Pin
new2pgrmg19-Oct-08 19:10
new2pgrmg19-Oct-08 19:10 
Questionhow to change the width of the text object and field object in crystal report dynamically through coding in C#.net Pin
prodipto_dutta0619-Oct-08 6:03
prodipto_dutta0619-Oct-08 6:03 
AnswerRe: how to change the width of the text object and field object in crystal report dynamically through coding in C#.net Pin
Tony Richards19-Oct-08 6:28
Tony Richards19-Oct-08 6:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.