|
You don't need the EntLib to serialize your class. Use XmlSerializer
XmlWriter writer = XmlWriter.Create("EmpData.config");<br />
XmlSerializer serializer = new XmlSerializer(typeof(Employee));<br />
serializer.Serialze(writer, employee);
only two letters away from being an asset
|
|
|
|
|
Thanks for your input.
I don't want to use XMLSerializer. Is this possible using EntLib or System.Configuration?
I remember something was there in EntLib 1.1 - Configuration.Write(FileName, Object);
Something similar in EntLib or in C# 2.0?
|
|
|
|
|
Is there something wrong with XmlSerializer? I'll give you a hint, Configuration.Write does the same thing, uses XmlSerializer.
only two letters away from being an asset
|
|
|
|
|
No issue... Just wanted to understand if there is any equivalent in EntLib 3.0 or C# 2.0 ?
No idea why the same thing is removed in new version of EntLib.
|
|
|
|
|
I have currency values in a dropdownlist that are formatting to look like $50, $100 etc using {0:C0}
I need to remove the $ symbol before converting the string to an Int32
I tried using LoanAmount.Replace("$", ""); but this doesnt work.
What should I be doing ?
|
|
|
|
|
digsy_ wrote: I tried using LoanAmount.Replace("$", ""); but this doesnt work.
Well, how did you used it? Assuming LoadAmount is string, you must do LoadAmount = LoadAmount.Replace("$", "") or use another string variable because strings are immutable types, original string CANNOT change.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
string s="$400";
s=s.substring(1,3);
int amnt=Convert.toInt32(s);
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Would work fine if the amounts were all three digits. What happens with $50 or $4000?
only two letters away from being an asset
|
|
|
|
|
I was merely explaining the principle, the code can be modified to handle the full length of the string.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Thomas Stockwell wrote: string s="$400";
s=s.substring(1,3);
int amnt=Convert.toInt32(s);
What if it's $4000
s=s.substring(1,s.Length);
int amnt=Convert.toInt32(s);
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
digsy_ wrote: I tried using LoanAmount.Replace("$", ""); but this doesnt work.
This will work: string temp=LoanAmount.Replace("$", "");
|
|
|
|
|
Assuming you are using .NET Framework v2.0 or later, you can use the Int32.TryParse(String, NumberStyles, IFormatProvider, Int32) method[^].
For the NumberStyles parameter, you probably want to use NumberStyles.Currency .
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Hey
I created one windows service and created the set and deployment project for that
I installed this service successfully at the client machine
now I want to see each step of the installation process on the client machine
Is byy default windows installer creating the install.log file or we have to create it?
if it is by default whats the location of the file?
or if we have to create how can it be?
please guide me...
Thanks in advance
|
|
|
|
|
Hi,
I want to implement a preview area which i want it to have a proportional size to the display resolution.
I have a workspace which is a form which is docked fill to my main window.
This is my panel size adjust function:
private void AdjustLayoutEditorSizeToDisplay(int width, int height)<br />
{<br />
int panelHeight;<br />
<br />
Console.WriteLine("Display size: " + width + " x " + height);<br />
Console.WriteLine("tpLayout size: " + this.Size.Width + "x" + this.Size.Height);<br />
Console.WriteLine("regionPanel initial size: " + regionsPanel.Size.Width + "x" + regionsPanel.Size.Height);<br />
int percent = Utility.PixelsToPercent(this.Size.Width, width);<br />
Console.WriteLine("The provided width is " + percent + "% of the maximum percentage.");<br />
<br />
if (percent > 100)<br />
{<br />
int diff = percent - 100;<br />
panelHeight = Utility.PercentToPixels(height, 100 - diff);<br />
Console.WriteLine("The height calculated based on the percentage is " + panelHeight + ".");<br />
}<br />
else<br />
{<br />
panelHeight = Utility.PercentToPixels(height, percent);<br />
Console.WriteLine("The height calculated based on the percentage is " + panelHeight + ".");<br />
}<br />
regionsPanel.Size = new Size(this.Size.Width, panelHeight);<br />
Console.WriteLine("regionPanel final size: " + regionsPanel.Size.Width + "x" + regionsPanel.Size.Height);<br />
}
I provide the resolution and suposly it will make the panel adjust its width to the workspace width and the height propotional to that.
But i found a problem, when docked, a panel seems to keep its original Size property and so it will not give me a correct proportion and it will not adjust its width to the workspace width.
WEll.. can somebody tell me if there is a turn around for this?
Thx,
Nuno
|
|
|
|
|
I am using C# and SQL 2005
for Web application How can I use TextChange event to the textbox to find the given data is exist in data base or not? Please give me an example.
please help me.
Laxmi
laxmi
|
|
|
|
|
You're asking a very top level question. The answer is, you handle the event, postback on it ( which is nasty ) and make a database call. If you can't conceptualise it on a level that's closer to the problem than that, then you shouldn't be undertaking this task.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thru AJAX you can achive this without postback
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Thank you very much for your mail. Some of the sites having this feature.
I dont know what is the code inside. But in my project i want to implement that type of code. Please give me an example by using postback. I dont know much about ajax.
Thank you
Laxmi R
laxmi
|
|
|
|
|
enakku intraikku time ayiduchi..Naan naalaikku solli kodukkiren..sariyaa
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
okey bye
see u tom.
Laxmi
laxmi
|
|
|
|
|
Change the properties of AutoPoatback = true
Then double click on textbox in design mode
you will get
protected void TextBox1_TextChanged(object sender, EventArgs e)<br />
{<br />
}
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
|
Hi,
I did as it is. But I want when press tab in T1
(textbox1) it check database whether the given data
in T1 is exist or not? if exist it give message like
already exist and it again wait for data there (T1)
only. once we are giving data which is not in the
database, then it moves to next field.
according to your logic it checks database. not
only that if we press tab it gives msg. and it
comes to next field. again we come back to T1 and
press tab with out changes, this time it won't give
any msg also.
Please help me.
with Thanks
laxmi
|
|
|
|
|
Hi,
I did as it is. But I want when press tab in T1
(textbox1) it check database whether the given data
in T1 is exist or not? if exist it give message like
already exist and it again wait for data there (T1)
only. once we are giving data which is not in the
database, then it moves to next field.
according to your logic it checks database. not
only that if we press tab it gives msg. and it
comes to next field. again we come back to T1 and
press tab with out changes, this time it won't give
any msg also.
Please help me.
with Thanks
laxmi
|
|
|
|
|
Good Day Sir/Maam:
I have a very simple question thats been bugging me ever since.
Clicking on the maximize button, the FORM (Window) will maximize, but the objects on will not.
Say I have a text box and a command button. If I hit maximize, the form will maximize but the text box and command button will just stay as is.
Is there anyway that they will maximize proportionaly?
Regards,
Ian
|
|
|
|