Click here to Skip to main content
15,885,878 members
Home / Discussions / C#
   

C#

 
GeneralRe: serial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
Member 647306614-Oct-09 5:58
Member 647306614-Oct-09 5:58 
GeneralRe: serial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
Tr@v14-Oct-09 7:30
Tr@v14-Oct-09 7:30 
GeneralRe: serial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
Member 647306614-Oct-09 11:11
Member 647306614-Oct-09 11:11 
QuestionCustom config sections problem. Pin
Zeokat30-Jun-09 4:48
Zeokat30-Jun-09 4:48 
AnswerRe: Custom config sections problem. Pin
Sk9330-Jun-09 5:10
Sk9330-Jun-09 5:10 
GeneralRe: Custom config sections problem. Pin
Zeokat30-Jun-09 6:12
Zeokat30-Jun-09 6:12 
JokeRe: Custom config sections problem. Pin
Sk9330-Jun-09 6:13
Sk9330-Jun-09 6:13 
QuestionToString() method on objects returned from a webservice (Compact framework) [modified] Pin
c0ax_lx30-Jun-09 4:43
c0ax_lx30-Jun-09 4:43 
Hi.
I'm having a problem and cannot find the solution. trust me, i've read lots on msdn and google'd, in the wrong places obviously but i hope someone here can help me.

I'm porting an application to compact framework 3 and to reduce client side load i created a webservice for the BL (also, else i would have to copy all code and compile to CF since i cant use "regular" dll's in CF)
this webservice exposes some custom classes and a couple of methods. a simple example would be

(in webservice)
public enum ToStringType {
FirstName,
LastName
}

public class person
{
public string firstname {get;set;}
public string lastname {get;set;}
public ToStringType stringtype {get;set;}
public person(){
stringtype = ToStringType.FirstName ;
}

public override ToString(){

public override string ToString()
{
string tostr = string.Empty;
switch (stringtype )
{
case ToStringType.FirstName :
tostr = FirstName;
break;
case ToStringType.LastName:
tostr = LastName;
break;

}
return tostr;
}

and the ws has a method returning person[]

on the client. when i run the method and get a list of persons
first of all:
myperson.ToString() returns the object class name. not first/last-name

so i add a method:
tostr (){
...
}
with the logic in tostring(),

this works. returns firstname. but
if i (on the client) myperson.stringtype =ToStringType.LastName;
and debug the application, i see that myperson.stringtype IS ToStringType.LastName
but the method returns firstname.
i would really get the tostring to work since i'm adding the person[] to a combobox and i prefer not to use datasource/bindings. (tried those to. same problem, Displaymember has no effect)

how come this split personality disorder in my classes, and why does ToString return the class name instead of my overloaded ToString method?

I hope someone can help me
regards Tomas

There is no spoon

modified on Tuesday, June 30, 2009 10:54 AM

AnswerRe: ToString() method on objects returned from a webservice (Compact framework) Pin
SeMartens30-Jun-09 4:52
SeMartens30-Jun-09 4:52 
GeneralRe: ToString() method on objects returned from a webservice (Compact framework) Pin
c0ax_lx30-Jun-09 4:57
c0ax_lx30-Jun-09 4:57 
GeneralRe: ToString() method on objects returned from a webservice (Compact framework) Pin
SeMartens30-Jun-09 5:08
SeMartens30-Jun-09 5:08 
GeneralRe: ToString() method on objects returned from a webservice (Compact framework) Pin
c0ax_lx30-Jun-09 23:14
c0ax_lx30-Jun-09 23:14 
QuestionQuick quest Pin
gwithey30-Jun-09 4:29
gwithey30-Jun-09 4:29 
AnswerRe: Quick quest Pin
musefan30-Jun-09 4:35
musefan30-Jun-09 4:35 
GeneralRe: Quick quest Pin
gwithey30-Jun-09 4:44
gwithey30-Jun-09 4:44 
AnswerRe: Quick quest Pin
c0ax_lx30-Jun-09 4:45
c0ax_lx30-Jun-09 4:45 
GeneralRe: Quick quest Pin
gwithey30-Jun-09 4:48
gwithey30-Jun-09 4:48 
GeneralRe: Quick quest Pin
c0ax_lx30-Jun-09 4:54
c0ax_lx30-Jun-09 4:54 
GeneralRe: Quick quest Pin
gwithey30-Jun-09 4:58
gwithey30-Jun-09 4:58 
GeneralRe: Quick quest Pin
musefan30-Jun-09 5:14
musefan30-Jun-09 5:14 
QuestionFilter GridView using a dropdown list but only after page populates with appropriate data from Query String Pin
mjc22530-Jun-09 4:23
mjc22530-Jun-09 4:23 
Questioncomplete removing of a C# COM component Pin
manustone30-Jun-09 3:24
manustone30-Jun-09 3:24 
QuestionCombobox and listbox control Pin
Hum Dum30-Jun-09 3:08
Hum Dum30-Jun-09 3:08 
AnswerRe: Combobox and listbox control Pin
musefan30-Jun-09 3:19
musefan30-Jun-09 3:19 
GeneralRe: Combobox and listbox control Pin
Hum Dum1-Jul-09 0:04
Hum Dum1-Jul-09 0:04 

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.