|
I have solve the problem on an easier way:
XAML:
<RichTextBox Height="223" HorizontalAlignment="Left" Margin="53,72,0,0" Name="rich" VerticalAlignment="Top" Width="182" BorderThickness="0" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Disabled">
<RichTextBox.Background>
<SolidColorBrush />
</RichTextBox.Background>
|
|
|
|
|
i have two forms(Form1 and Form2).i open Form2 as a child of Form1 with the code below..
Form2 frm2 = new Form2();
frm2.MdiParent = this;
frm2.Show();
but Form2 is opened under of Form1's controls..how i will get it front..i tried right click and send back to all controls in Form1 but still nothing..what should i do now ?
|
|
|
|
|
This question should be placed into Windows Forms forum. I will answer anyway, but try to use the right forum next time.
Usually the visible controls used within a MDIContainer Form should be MenuStrip, StatusStrip and ToolStrip. What controls are you using in Form1?
|
|
|
|
|
i have two datagridviews and buttons in parent form..but i think there will be more controls like textboxes..so what can i do now
i tried also
frm2.TopMost=true;
frm2Activate();
but i couldnt get the result
|
|
|
|
|
Ok, I see. Add a ToolStripContainer to Form1, change its Dock property to Top, and move all that stuff you have in Form1 into this ToolStripContainer.
|
|
|
|
|
thanks for the reply friend..i tried like
Form2 frm2 = new Form2();
frm2.MdiParent = this.MdiParent;
frm2.Show();
it is opened on other controls but when i want to minimize i want to stay it in main form but it is seen on task bar
how i will manage it ?
modified on Saturday, October 23, 2010 8:01 AM
|
|
|
|
|
|
thanks for reply..i tried that too..but it is not the thing i want exactly..in that style it stays a little upper than task bar.. i want it to be minimized in my form1
|
|
|
|
|
It is here:
frm2.MdiParent = this.MdiParent;
I guess your Form1 MdiParent is null, so you are setting null to MdiParent property of your frm2, and it opens as a "not MdiChild" form. It should be:
frm2.MdiParent = this;
Place your code into a <pre> tag for posting it here in the forum. It will be easier to read for us.
Bye
|
|
|
|
|
ok friend
thanks for your help
|
|
|
|
|
Hello Everybody,
I am tring to create a Function with Optional Argument but it generate an error.
Error Default parameter specifiers are not permitted
What is wrong with that?
Thanks
If you can think then I Can.
|
|
|
|
|
Hi,
C# only supports optional parameters since C# 4.0 If you compile your code using an earlier version you will get this error. Please make sure you have selected .Net 4.0 as target framework of your project. If you are not going to use .Net 4.0 you will need to use overloads to achieve the same goal as using optional parameters.
|
|
|
|
|
Which version of C# are you using?
Optional parameters are only permitted in C#4.0.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
I wrote an article about Optional Arguments here[^] it explains the syntax. As the other posters said, you need to use .NET 4 first.......
|
|
|
|
|
Thank u everybody
If you can think then I Can.
|
|
|
|
|
Hi I am trying to figure out why my method keeps only showing me the first character from a sent string. I would like it to show all the characters that were sent.
public void OnDataReceived(IAsyncResult asyn)
{
try
{
SocketPacket socketData = (SocketPacket)asyn.AsyncState;
int iRx = 0;
iRx = socketData.currentSoc.EndReceive(asyn);
char[] chars = new char[iRx];
System.Text.Decoder d = System.Text.Encoding.UTF8.GetDecoder();
int charLen = d.GetChars(socketData.dataBuffer, 0, iRx, chars, 0);
System.String szData = new System.String(chars);
MessageBox.Show(szData);<<<<<<<<<<<<What ever message is sent is supposed to show up in this message box...
WaitForData(socketData.currentSoc);
}
catch (ObjectDisposedException)
{
System.Diagnostics.Debugger.Log(0, "1", "\nOnDataReceived: Socket has been closed\n");
}
catch (SocketException se)
{
MessageBox.Show(se.Message);
}
}
|
|
|
|
|
Instead of
System.String szData = new System.String(chars)
you could try
StringBuilder str = new StringBuilder();
for (int x = 0; x < charLen; x++)
{
str.Append(chars[x]);
}
I haven't had a problem with that.
Brent
|
|
|
|
|
Hate to break it you, but this had no effect.
|
|
|
|
|
What happens when you put a break point at socketData.currentSoc.EndReceive and then step over the code? What do you see when you watch the variables?
[Edit]I see you don't like debugging - too much like hard work is it?[/Edit]
I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Onyx
modified on Saturday, October 23, 2010 6:47 AM
|
|
|
|
|
Several things could be wrong here, however I can't tell which one(s) it will be as you have shown only a fraction of the relevant code. Here are the main possibilities:
1.
you may be invoking a receive with a small buffer; if you were to ask for one byte, then you would only get one byte.
2.
you might have an encoding mismatch between sender and receiver. e.g. if the sender uses Unicode, regular characters would look like real (ANSI) bytes and NULLs intertwined; an 8-bit encoder would react badly on the NULLs.
3.
what EndReceive returns is the number of bytes, not characters, hence char[] chars = new char[iRx]; is wrong. IMO you should use [EDIT] Encoding.GetString() right away to convert bytes into a string.[/EDIT]
|
|
|
|
|
So Im reading a csv file and splitting the string with "," as the deliminator
but some of them have quotes as to not split the specific field because it has a comma in it.
1530,Pasadena CA,"2008, 05/01","2005, 12/14"
with just comma it would be:
1530
Pasadena CA
"2008
05/01"
"2005
12/14"
I need it to take commas into consideration when splitting so its like this
1530
Pasadena CA
"2008 05/01"
"2005 12/14"
|
|
|
|
|
You may wish to do a search and replace of all commas within the valid bounds of the quotation marks first(with a ~ perhaps ), and then use the resulting string to do the split.
After you have done that you could just do a search and replace on all the split elements to replace the tildes with a comma again.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Please do not use this solution - the FileHelper one is much better and easier to use / understand.
You can't do that easily with string.Split - it only works on a single character. You will either have to do it manually or use a regex:
string inputText = @"1530,Pasadena CA,""2008, 05/01"",""2005, 12/14""";
Regex regex = new Regex("(?=,)|[^\",]+|\"(?:[^\"]|\"\")*\"",
RegexOptions.Compiled);
MatchCollection ms = regex.Matches(inputText);
foreach (Match m in ms)
{
if (m.Length > 0)
{
Console.WriteLine(m.Value);
}
}
The regex looks ugly, but it was thrown together a bit quickly - that's why it generates blank matches.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
you may want and read the Rive[^] article PIEBALD created.
|
|
|
|
|
10!
|
|
|
|