|
Tridip Bhattacharjee wrote: please guide me that how could i detect mouse over & out on minimize SDI window in MDI application with c#.
Only works for the client-area, and the caption isn't part of that. I'd suggest you hide them and show a Panel where the minimized Window would have been.
I are Troll
|
|
|
|
|
Hi,
String temp;
foreach (DataRow row in Table.Rows)
{
foreach (DataColumn column in Table.Columns)
{
if(row[column].ToString().Contains("%"))
{
temp = row[column].ToString().Replace("%"," ");
row[column] = temp;
}
}
}
Table.AcceptChanges();
Table is nothing but a datatable...
and when im trying to run the below code... im getting error like input string was not in a correct format
in the below highlighted line of code..
String tem;
foreach (DataRow row in Table.Rows)
{
foreach (DataColumn column in Table.Columns)
{
if (row[column].ToString().Contains(" "))
{
tem = row[column].ToString().Replace(" ", "%");
row[column] = temp;
}
}
}
Table.AcceptChanges();
Please help me regarding the same..
modified on Thursday, May 12, 2011 1:14 AM
|
|
|
|
|
I think you are getting error when trying to convert DateTime values.
A DateTime value "{6/1/1998 12:00:00 AM}" has a space and it tries to convert to "{6/1/1998% 12:00:00 AM}" which is not valid.
Change to below code to resolve this.
if (row[column].ToString().Contains(" ") && column.DataType != Type.GetType("System.DateTime") )
{
temp = row[column].ToString().Replace(" ", "%");
row[column] = temp;
}
Regards
Rushi
|
|
|
|
|
no i don"t have any column which of datetime type and even i tried the above code it"s not working....
|
|
|
|
|
check whether it is a strongly typed data table
|
|
|
|
|
no it"s not strongly typed datatable..
-- Modified Thursday, May 12, 2011 2:20 AM
|
|
|
|
|
How can you directly assign to a foreach iteration variable ? It will throw an error , right ?
|
|
|
|
|
He isn't: he is modifying the content of a foreach variable - completely fine!
foreach (item i in myList)
{
i.Contents = "New value";
} Will work,
foreach (item i in myList)
{
i = "New value";
} Will not.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Are our DataTable columns of type string ? Because if they aren't, then data conversion will occur, and "%" will likely be an invalid character in the input string.
I assume you are also the author of this: http://www.codeproject.com/Answers/195111/input-string-is-not-in-correct-format-error-when-u.aspx[^] Q&A question, where you give more details.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
please give reply in the link which OriginalGriff provided...
|
|
|
|
|
I already provided you with what may be essential information here[^].
However you did not provide sufficient information to come up with the definitive answer. What column type is it? how does it get formatted? Are you using an explicit Cell Style? Are you using the CellFormatting event? Do you want to change the value itself, or just how it looks when shown in the DGV?
pradeep455 wrote: if (row[column].ToString().Contains(" "))
{
tem = row[column].ToString().Replace(" ", "%");
row[column] = temp; //getting error in this line...
}
I am not surprised you are getting an error here: if the cell is a string type, then ToString() is redundant; so I'll assume the cell isn't holding a string. Now how could you assign a string value to it then?
So rather than asking over and over again, please just ask once and provide all that is required.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
as i already said i had provide the complete info at http://www.codeproject.com/Answers/195111/input-string-is-not-in-correct-format-error-when-u.aspx
Actually the columns in the datatable is string type..my requirement is when user clicks on the header sorting should
happen ...and the datatable(3 columns) contains values in 2nd,3rd columns were like..
2%,5%,6% etc...and in 1st column 1,2,3..
so wat i tried is im creating one more column of decimal type dynamically when user clicks on column..from the values in the column(after removing % from the string values and converting to decimal)...
correct me if im wrong..
-- Modified Monday, May 16, 2011 4:42 AM
|
|
|
|
|
You should not be using a string-type column at all; if the data is numeric, use a numeric-type column, that will give you numeric sorting instead of alphabetical sorting (i.e. 9 - 10 - 11 and not 10 - 11 - 9). There is a difference between what a cell value means (a number, a percentage, whatever) and how it looks (with or without thousands separator, with or without a % sign, etc), that is what cell format properties and events are taking care of. I think I already told you all that.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Please stop reposting this. You have asked the same question twice on this forum and at least twice in the Questions area.
|
|
|
|
|
i need to get the character when the unicode is given.
for example :
i get the unicode values as a string -> "\U0061" so then i need to get the character for this unicode value.
i know that i can use "char c = '\U0061' but unfortunately i get the Unicode value as a string, so what i need is to get the character by that string .
anyone got an idea to do this.
thanx in advance.
modified on Wednesday, May 11, 2011 12:30 PM
|
|
|
|
|
I only know three ways to do something of that kind.
string s="\U0061";
char c0=s[0];
char c1='\u0061';
char c2=(char)0x0061;
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Wednesday, May 11, 2011 1:04 PM
|
|
|
|
|
thanx, the first one is the option that i could apply , but it also not working for me, i tried the first option and i still get the first character in the string . any idea about it . thanx.
|
|
|
|
|
prasadbuddhika wrote: i still get the first character in the string
?????????????????????
string s only holds one character. the whole backslash-u-fourdigirs thing is C#'s way to specify a single character by its Unicode character number.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
thanx Luc, i had made a mistake , i had used "U" instead of "u" , when i use "U" it gives me the unrecognized escape sequence . but with "u" it works fine thank you.
|
|
|
|
|
You can parse it as int (the 0061 part) and then cast to char .
|
|
|
|
|
could you please guide me on that. thanx.
|
|
|
|
|
First search for occurrences of \\U[0-9]+ (that's a regex, the backslash is escaped and you may have to doubly-escape it)
Then replace it with (char)int.Parse(match.Value.Split('U')[1]) (though I would refactor that)
|
|
|
|
|
You have a problem. The four digits after the \u are HEX not decimal. So int.Parse won't cut it.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
OP didn't say so, so how do you know?
|
|
|
|
|
Because that's the way \unnnn works. Big brother to the \xnn convention for single byte characters.
Borrowing a couple of sentences from the Java Language Specification, section 3.2:
A Unicode escape of the form \uxxxx, where xxxx is a hexadecimal value, represents the Unicode character whose encoding is xxxx. This translation step allows any program to be expressed using only ASCII characters.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|