|
|
An example here[^]. I think it's written with VB.NET, but that shouldn't be a problem.
RSS feed
|
|
|
|
|
Hello
I ned create a form dynamically from an XML document, the xml file must contain the control type, the variable name asociated to this control, ..., i.e.
<parameter>
<param name="Age" />
<controltype>Editbox
<desc>Client age
<type>Integer
<min>21
<max>40
<value>25
Please help me
|
|
|
|
|
I have a number with a decimal place and I need to round it does anyone know how?
|
|
|
|
|
Decimal.Round()
Mazy
No sig. available now.
|
|
|
|
|
|
I have the next code:
.
.
StreamReader inp = new StreamReader(@"c:\inp.txt");
Tx1.Text = inp.ReadLine();
inp.Close();
.
.
inp.txt contains "¡¡¿¿Test??!!"
and after reading line, Tx1 has = "Test??!!"
The ¡ and ¿ were ignored!! The same thing occurs with ñ, á, etc.
What is happenning?
Best regards
|
|
|
|
|
I guess the problem is come from Unicode Encding. Use other cunstructors of StreamReader which you can specify Encoding type in them.
Mazy
No sig. available now.
|
|
|
|
|
I made:
StreamReader inp = new StreamReader(@"c:\inp.txt",System.Text.Encoding.UTF7);
Tx1.Text = inp.ReadLine();
Inp.Close();
and it worked. Thanks.
However, it is the firts time I experienced this kind of problem. I live in South America. Now, ¿should I change all my thousands of programs to include this encoding parameter? or is this possible to change it any kind of global parameter?
Thanks for your help
|
|
|
|
|
Rostrox wrote:
However, it is the firts time I experienced this kind of problem. I live in South America. Now, ¿should I change all my thousands of programs to include this encoding parameter?
As far as your programs wants to work with Unicode world ,I think you should apply these change to them.
Mazy
No sig. available now.
|
|
|
|
|
I have two apps Test.exe, Server.exe
I'm using BinaryFormatter.Serialize() to Serialize my own class in the Test.exe App and send the resultant byte array across a socket to Server.exe and use BinaryFormatter.Deserialize() to recreate my class. But I'm getting the following Error on Deserialize in Server.exe
{"Cannot find the assembly Test, Version=1.0.1460.21386, Culture=neutral, PublicKeyToken=null." }
This seems to me that either:
1. I cannot Serialize with one app and deserialize with another.
Or
2. I'm missing something
I think its #2, any ideas ?
|
|
|
|
|
You are trying to deserialise a class that resides in another assembly.
If you define two identical classes, with the same name in two different assemblies, they are NOT the same class.
The solution to this would be to create the class in a DLL, thereby removing the assembly from the serilaistion (or something, but it makes it assembly independent), refference the object in the DLL from both assemblies, and run it from there.
Then you can deserialize without problems.
That should solve it m8.
Regards, and happy new year
Cata
|
|
|
|
|
Thanks for the reply,
That seems like overkill for a class that has three byte[] arrays.
Perhaps using the serliaization is not the correct approach then.
How would you send a storage class like this one over a socket between two different apps ?
Here is the class:
[Serializable]
class CipherMessage
{
public byte[] cipherBytes; // RC2 encrypted message text
public byte[] rc2Key; // RSA encrypted rc2 key
public byte[] rc2IV; // RC2 initialization vector
}
|
|
|
|
|
Remember a DLL is a library. If you have multiple classes you want to transfer between your apps, you could declare them all in there.
The alternative is break down the class into Byte arrays, serialize them, and send them as that, then deserialize and reasemble them at the other end. But that seens even more long winded than buidling a DLL.
Seriously, a DLL isn't hard, and it's probably the most sensible way to go. Just declare the type in a DLL and build it. Then add it through the refferences. You can add more classes later if you want. Alternatively, build the DLL in the same project as the other two executables, and refference it direct.
Cata
|
|
|
|
|
Just FYI...
If you're exchanging keys, you should take a look at the AsymmetricKeyExchangeFormatter class. Do a google search to find a good example of using it.
I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.
-David St. Hubbins
|
|
|
|
|
Thanks for the advice, but If I'm using Public/Private Key RSA(which I am) do I still need to use this class ? It appears to encrypt private key exchanges.
|
|
|
|
|
It's "recommended" according to the docs. I wrote a library that used a stream to send RSA encrypted files across a it, and I used that class to exchange the key. I then wrote a client and server that created network streams to send files across sockets.
I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.
-David St. Hubbins
|
|
|
|
|
You could also create a SerializationBinder that can bind one Type (based on a string) to another Type. Cata's advice is best, though, and is common - especially when doing .NET Remoting. You have a shared assembly that contains the Types (which is a name, assembly, version, culture, and public key token) that both client and server use. This is the correct approach. Using a SerializationBinder is more for upgrading serialized documents between versions, or when you absolutely have to use a Type that you can get access to otherwise.
Search the C# forum for SerializationBinder for a previous discussion I was involved in some time back.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
If anyone has an idea what rubber banding is, and how you can introduce it to a drawing program. Please contact me
email2miles@yahoo.com
|
|
|
|
|
Why not look it up in google?
Cata
|
|
|
|
|
|
how could i use the mschart in a c# code ,,,i simply need to give my chart 2 columns(coulmn 1 actual cost,coulmn 2 actual cost) ,i need axis y only with millions,and i 've the coulmn value in variables plz answer me quickly..
|
|
|
|
|
|
You must set ColumnNumber and RowNumber first. ColumnNumber is the number of kind of data ( in simple, total color that you see in chart ). The RowNumber is the total data that you want to show ( Default : R1, R2, R3 , ... ). To fill the data you can do this.
//Fill the first column, the second row
myChart.Column = 1;
myChart.Row = 2;
myChart.Data = 25;
NOTE : The property name may be wrong as I don't remember it precisely. But that is the main idea in using ActiveX MSChart.
|
|
|
|
|
Hello all,
I have a tab control which initially has one tab page. I want to dynamically create some more tab pages which should have the same controls as the first one.
To read the controls on the first page I am doing the following :
Control[] myObjArray = new Control[this.tabControl1.TabPages[2].Controls.Count];<br />
this.tabControl1.TabPages[2].Controls.CopyTo(myObjArray,0); The problem is, when I try to add the controls obtained using the above method, the controls are removed from the first page.
Control NewControl = new Control();<br />
NewControl = (Control)myObjArray[nCount];<br />
myTabPage.Controls.Add(NewControl);
This method however successfully puts the controls on the newly created page.
Any ideas how I can have the controls on both the pages ?
Thanks in advance.
Regards,
Amit
|
|
|
|