Thursday, March 29, 2012
Separate String
I have a string as follows:
MyString="Name1,Name2"
I want to create 2 strings from it:
String1 = "Name1"
String2 = "Name2"
So String1 gets the characters on the left of "," and String2 the
characters on the right.
How can I do this?
Thanks,
Miguelhello
you can use the String.Split method for that
http://authors.aspalliance.com/aspx...lasssplit1.aspx
string[] parts = MyString.Split (',');
parts[0] will be 'Name1' and parts[1] will be 'Name2'
HTH
"shapper" <mdmoura@.gmail.com> wrote in message
news:1160179555.140385.26930@.i3g2000cwc.googlegroups.com...
Hello,
I have a string as follows:
MyString="Name1,Name2"
I want to create 2 strings from it:
String1 = "Name1"
String2 = "Name2"
So String1 gets the characters on the left of "," and String2 the
characters on the right.
How can I do this?
Thanks,
Miguel
Dim MyString2 As String = MyString.Split(",")
MyString2(0) = "Name1"
MyString2(1) = "Name2"
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com/
****************************************
*********
Think Outside the Box!
****************************************
*********
"shapper" <mdmoura@.gmail.com> wrote in message
news:1160179555.140385.26930@.i3g2000cwc.googlegroups.com...
> Hello,
> I have a string as follows:
> MyString="Name1,Name2"
> I want to create 2 strings from it:
> String1 = "Name1"
> String2 = "Name2"
> So String1 gets the characters on the left of "," and String2 the
> characters on the right.
> How can I do this?
> Thanks,
> Miguel
>
Separate String
I have a string as follows:
MyString="Name1,Name2"
I want to create 2 strings from it:
String1 = "Name1"
String2 = "Name2"
So String1 gets the characters on the left of "," and String2 the
characters on the right.
How can I do this?
MiguelThe Split method of string should work:
Dim sAs String ="test1,test2"Dim ssAs String() = s.Split(",")Dim test1As String = ss(0)Dim test2As String = ss(1)
Separate String
I have a string as follows:
MyString="Name1,Name2"
I want to create 2 strings from it:
String1 = "Name1"
String2 = "Name2"
So String1 gets the characters on the left of "," and String2 the
characters on the right.
How can I do this?
Thanks,
Miguelhello
you can use the String.Split method for that
http://authors.aspalliance.com/aspx...lasssplit1.aspx
string[] parts = MyString.Split (',');
parts[0] will be 'Name1' and parts[1] will be 'Name2'
HTH
"shapper" <mdmoura@.gmail.comwrote in message
news:1160179555.140385.26930@.i3g2000cwc.googlegrou ps.com...
Hello,
I have a string as follows:
MyString="Name1,Name2"
I want to create 2 strings from it:
String1 = "Name1"
String2 = "Name2"
So String1 gets the characters on the left of "," and String2 the
characters on the right.
How can I do this?
Thanks,
Miguel
Dim MyString2 As String = MyString.Split(",")
MyString2(0) = "Name1"
MyString2(1) = "Name2"
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com/
*************************************************
Think Outside the Box!
*************************************************
"shapper" <mdmoura@.gmail.comwrote in message
news:1160179555.140385.26930@.i3g2000cwc.googlegrou ps.com...
Quote:
Originally Posted by
Hello,
>
I have a string as follows:
MyString="Name1,Name2"
>
I want to create 2 strings from it:
String1 = "Name1"
String2 = "Name2"
>
So String1 gets the characters on the left of "," and String2 the
characters on the right.
>
How can I do this?
>
Thanks,
Miguel
>
Monday, March 26, 2012
Serializable
Hello,
I have a class with various properties: strings, integers, controls, etc.
I made this class serializable using:
[Serializable]public class Employee...
My question is:
Can I do this when I have properties of type control?
What data types can my class properties have?
Thanks,
Miguel
Control type itself isn't serializable so it won't serialize even if the class having the property (of Control type) is marked serializable. By default all primitive types (integers, strings etc) are serializable but then with other types it is based on if the class is serializable (at least has serializable attribute applied and optionally implements ISerializable or IXmlSerializable interfaces).
More information:
Basics of .NET Framework Serialization
http://msdn2.microsoft.com/en-us/ms233836(VS.80).aspx
And what about object type?
Basically, I am creating a class which has a property as follows:
Private Box As Generic.List(Of Object)
Now I am adding strings, or booleans, or integers or other basic types to this Generic List (I think it should be of type object since I would like to use various types).
Then I want to serialize it and save it in the SQL database. Later I will retrieve it.
Is this possible?
Thanks,
Miguel
Generic List itself is serializable so as long as those objects you put to the List are serializable, things work fine.Serializability of the real type (of added object) is what matters.
Just note that if you use XML serialization, private members won't be serialized (only public members and properties).
If I use a property which type is a structure that has properties of strings and integers.
Is this serializable?
Thanks,
Miguel
Yes
Serializable
I have a class with various properties: strings, integers, controls,
etc.
I made this class serializable using:
[Serializable]
public class Employee
...
My question is:
Can I do this when I have properties of type control?
What data types can my class properties have?
Thanks,
MiguelAll types must be serializable.
"shapper" <mdmoura@.gmail.com> wrote in message
news:1173458335.254148.207780@.j27g2000cwj.googlegroups.com...
> Hello,
> I have a class with various properties: strings, integers, controls,
> etc.
> I made this class serializable using:
> [Serializable]
> public class Employee
> ...
> My question is:
> Can I do this when I have properties of type control?
> What data types can my class properties have?
> Thanks,
> Miguel
>
Input & Output types that is, not types used exclusively for internal class
processing.
"Scott M." <s-mar@.nospam.nospam> wrote in message
news:u53KtnmYHHA.4396@.TK2MSFTNGP06.phx.gbl...
> All types must be serializable.
>
> "shapper" <mdmoura@.gmail.com> wrote in message
> news:1173458335.254148.207780@.j27g2000cwj.googlegroups.com...
>
Serializable
I have a class with various properties: strings, integers, controls,
etc.
I made this class serializable using:
[Serializable]
public class Employee
...
My question is:
Can I do this when I have properties of type control?
What data types can my class properties have?
Thanks,
MiguelAll types must be serializable.
"shapper" <mdmoura@.gmail.comwrote in message
news:1173458335.254148.207780@.j27g2000cwj.googlegr oups.com...
Quote:
Originally Posted by
Hello,
>
I have a class with various properties: strings, integers, controls,
etc.
>
I made this class serializable using:
>
[Serializable]
public class Employee
...
>
My question is:
>
Can I do this when I have properties of type control?
>
What data types can my class properties have?
>
Thanks,
>
Miguel
>
Input & Output types that is, not types used exclusively for internal class
processing.
"Scott M." <s-mar@.nospam.nospamwrote in message
news:u53KtnmYHHA.4396@.TK2MSFTNGP06.phx.gbl...
Quote:
Originally Posted by
All types must be serializable.
>
>
"shapper" <mdmoura@.gmail.comwrote in message
news:1173458335.254148.207780@.j27g2000cwj.googlegr oups.com...
Quote:
Originally Posted by
>Hello,
>>
>I have a class with various properties: strings, integers, controls,
>etc.
>>
>I made this class serializable using:
>>
>[Serializable]
>public class Employee
>...
>>
>My question is:
>>
>Can I do this when I have properties of type control?
>>
>What data types can my class properties have?
>>
>Thanks,
>>
>Miguel
>>
>
>