|
I'm reading text data from an xml file where there are potential newlines embedded into the string, but in some places I need to display the full text on a single line. Whenever I doso however I get to of the empty blocks used as placeholders for unprintable chars.
The xml data looks like this:
<comment>line one
line two</comment>
after reading it into a string (indirectly using the xml classes (we're using encapsulated versions that hide the ugly details)) I've tried both of the following unsuccessfully to remove the newlines.
s.Replace("\n"," ");
s.Replace(Environment.NewLine," ");
|
|
|
|
|
Strings are immutable
s = s.Replace(Environment.NewLine, "");
|
|
|
|
|
Woops, I knew that. :-/
Would've been nice if the compiler gave a warning though.
|
|
|
|
|
Hi everyone,
Is there an event like Form.Resize that is raised only after the user has finished resizing the form, i.e., when the mouse button is released at the end of the resize operation?
Thanks
|
|
|
|
|
I would imagine that it would be the Form_OnPaint() method.
|
|
|
|
|
But that not specific to resizing. The Paint event fires every time the form is being redrawn, for example when you move other applications over it. I'm looking for something that signals a resize, but that would fire AFTER, not WHILE the resize is taking place.
Thanks
|
|
|
|
|
I believe the short answer is no.
You can use the SizeChanged() event which fires AFTER every size change, but not after the mouse has been released. Normally you would want this to happen anyway so that you get the 'smooth' resize effect.
Using a combination of SizeChanged() and MouseUp() events won't work because the MouseUp() event isn't "Mousing-up" on the form. It is "Mousing-up" on the resize handle.
Unfortunately using OnPaint() won't work either.
Is there a specific reason why you need it after the mouse has been released?
|
|
|
|
|
Thanks. I'm not interested in the mouse release per se, I just want to refresh the form only once when the user drags the corner of the window, and not update it continuously while it's being resized, which causes flicker.
Thanks, maybe SizeChanged would work.
|
|
|
|
|
Flickering effects is a common problem to user controls. I'm not sure if this fits your situation (as I've only used it for controls), but it may help.
For user controls, setting Control.SetStyle to ControlStyles.DoubleBuffer and ControlStyles.AllPaintingInWmPaint will paint to an off-screen bitmap first. In your case you could try this.SetStyle.
I found this web site helpful:
http://pluralsight.com/wiki/default.aspx/Craig/FlickerFreeControlDrawing.html[^]
|
|
|
|
|
Even with double buffering, if one of your controls was sufficiently timeconsuming to redraw delaying redraw until the end of the resize would be useful. One untested idea about how to do that would be to have the SizeChanged event disable OnPaint and start a thread with a timer to reenable it after X time, with each call of SizeChanged resetting the timer.
|
|
|
|
|
hello
i have a problem regarding button handling. if i want to click a button1 and want that a variable value is set to like 4 after that button i must have to click second button and another variable value is set to like 5 then when i click ok button a function will be called and pass these variable values to a function. how will i implement this problem and can i return a value form a button function if yes then how please tell through sample code or simple statements thanks
|
|
|
|
|
That's just elementary C# coding. Create a form. Add a set of buttons (1, 2, 3, etc.) Write a click handler event
private void ButtonClickHandler(object sender, EventArgs args)
{
Button which = (Button) sender;
input += which.Text;
}
In the property grid you switch over to the event view and assign this handler method to all of your buttons. You may want an Enter key on the form as well....that way people can enter more than a single digit to feed the function. So then you'd double click the Enter click event which will automatically create an event handler foryou and you can add the following code:
private void Enter_Click(object sender, EventArgs args)
{
if (variableA == null) {variableA = input; input = string.Empty;}
else {variableB = variableA; variableA = input;}
}
when you click the function button you just do
CallFunction(variableA, variableB)
Now if you cannot solve your problem with what I've given you, then I highly recommend you start taking developer classes.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
I am developing an app on a laptop, using VS and C# 2003. The app will run on a tablet PC in portrait mode.
How can I develop the app on my laptop for a 760X1024 orientation when VS won't allow it (the 1024 height setting always jumps down to 812). the tablet sdk 1.7 doesn't seem to have anything for this. Is there a workaround?
|
|
|
|
|
I'm trying to do something that I thought was fairly simple, but I can't seem to figure it out.
I want a rich text box to be double-spaced. I've tried inserting rtf codes into the rtf of the rich text box, but nothing seems to happen. I've tried several different methods, such as:
rtbLyrics.Rtf = rtbLyrics.Rtf.ToString() + @" \sl0 \slmult1 ";
AND
rtbLyrics.Rtf = rtbLyrics.Rtf.Insert(rtbLyrics.Rtf.Length,@" \sl0 \slmult1 ");
AND
rtbLyrics.Rtf += @" \sl0 \slmult1 ";
but these don't have any effect.
How do I do this?
|
|
|
|
|
I am using HttpWebRequest and Response classes in order to query a third party database.
But the problem is , encoding is in ISO_8859 format and couldnt retrieve some characters ..as I looked so far in the method of streamReader class , only ASCII , utf 7-8 and a few more are available..But I want to encode streamReader with ISO-8859
So far I am using the following method.
sr = new StreamReader(resp.GetResponseStream(), System.Text.Encoding.UTF8);
..
How could I achieve this?
Any suggestions or piece of code will be welcomed
Thanks in advance.
|
|
|
|
|
There's a static System.Text.Encoding.GetEncoding() method you can use to get a certain encoding with a given name.
Regards,
mav
|
|
|
|
|
I am trying to write an application that I believe will be very intense and I don't know to accomplish the main task within this application. What I would like to have is an application in which I can load all of my banking and credit card information. I would then like be able to go to this application periodically and click an update button to update all of my account information(balance, minimum payment, available credit, etc). What kind of stuff do I have to use in order to accomplish this?????? What direction do I need to head???????
Thanks,
Kendal
Kendal Goodrich
|
|
|
|
|
I'd have to study your account info to answer this better. Go ahead and sent account numbers, passwords, etc.
|
|
|
|
|
You need to head over to all of your banking web sites and see if they have API's or webservices you could use to do this (I seriously doubt it!) Other than that, you'll probably be relying on web page scraping.
|
|
|
|
|
I kind of figured that I would have to have web access to my accounts, which I do with most of them. I got this idea from wells fargo(my mortgage company). I go to the website to check my mortgage status and they have a "one look" page where I can enter information on my online accounts(bank accounts, credit cards, etc). Credit Card example: First I select from a long list of Creditors, I enter information such as my account number, online login, password, etc. I can then get a view of my balances on all entered account from my wells fargo one look page. I can also press a refresh button on the web page and have all my information updated with recent balances. I was kind of hoping I could design an application that could do basically the same thing, but pull a little bit more of my information to display. I would like to know how wells fargo is going about accomplishing what they do. Can anyone give me some insight on how I may accomplish this??????
Kendal Goodrich
|
|
|
|
|
Wells Fargo has the advantage of being a banking institute. They have access to the various interchanges, stand-in processors, etc. that allow them to request the balance information from any institution. Basically what they are doing on the web site is faking an ATM balance inquiry based on the account information you provide.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
Hello,
Is there a way of validating that only an integer values could be entered
into a cell for a particular column in datagrid.
Thank you
|
|
|
|
|
There is always a way. What is the context, Windows app, Web page???
|
|
|
|
|
Thank you,
But I already figured it out. It's a Windows App
However there is a bigger problem.
In my datagrid, upon loading I have a few rows, also I have an even
which fires on Leave and TextChange:
foreach( DataGridTextBoxColumn dataGridTextBoxColumn in this.styleLotYields.GridColumnStyles ) {<br />
dataGridTextBoxColumn.TextBox.TextChanged += new EventHandler(this.GridTextBoxTextChanged);<br />
dataGridTextBoxColumn.TextBox.Leave += new EventHandler(this.GridTextBoxLeave);<br />
}
But when the app is running and by modifying the grid it adds another row, which is good, the Leave and Change text does not see the value entered in the textbox, although the Row and Column indexes are correct for a particular cell. I just don't know what's going on. Any ideas?
Thank you
|
|
|
|
|
Call this Function in the TextChanged Event before validating the data
private void EndEditOperation()
{
if (this.currentGridRow >= 0)
{
CurrencyManager currencyManager = (CurrencyManager) this.dataGridAllocation.BindingContext[this.dataTable];
if (currencyManager != null)
{
currencyManager.Position = this.currentGridRow;
DataGridColumnStyle dataGridColumnStyle = this.dataGridAllocation.TableStyles[0].GridColumnStyles[0];
this.dataGridAllocation.EndEdit(dataGridColumnStyle, this.currentGridRow, false);
}
}
}
Live Life King Size
Alomgir Miah
|
|
|
|