|
hey the blog for which you have created a link is in some other language then english...plz tell how to convert it in english otherwise please explain in detail as to how get the location of the controls and then add them in the xml file...Please help!!!!!!
.Net Developer
|
|
|
|
|
You cannot get them in any particular order from the controls collection. You will need to loop through the controls collection several times, finding out which control to fetch for every loop.
It should also be possible to add all the controls to a SortedList and write a custom comparer that can determine if one control should be sorted before another depending on Left and Top properties if that is what you want.
|
|
|
|
|
i dont think thats possible...as for me i am creatin an application where i want to convert the whole form presented to me into an XML file and this is dynamically so i dnt knw which controls are there and in which order i just want to fetch those controls on the form in the order in which we usually put the controls ie top to bottom and left to right..
the form may have 10controls also and 50 controls also...
.Net Developer
|
|
|
|
|
I don't see a contradiction there. You just need to define rules to determine how to sort the controls. You will need the rules anyway you turn, because there is no such sorting built in.
|
|
|
|
|
how to manage profile object on shared shared. when i try to run application, server raise permission error.
|
|
|
|
|
I want to display a string instead of number in a DataGridView.
I have a column "Status" in a DataSet which DataType in SQl is int, but when displaying the data in the DataGridView I want to display the meaning for that int.
How i can do that ?
I write function, but it seem doesn't work and it give me an error message:
"private void StatusClarification()
{
for (int i = 0; i < this.dtgCreditInfo.Rows.Count; i++)
{
if (int.Parse(this.dtgCreditInfo.Rows[i].Cells["Status"].Value.ToString()) <= -1)
this.dtgCreditInfo.Rows[i].Cells["status"].Value = "Modified";
if (this.dtgCreditInfo.Rows[i].Cells["Status"].Value.ToString() == "1")
this.dtgCreditInfo.Rows[i].Cells["status"].Value = "New";
if (this.dtgCreditInfo.Rows[i].Cells["Status"].Value.ToString() == "0")
this.dtgCreditInfo.Rows[i].Cells["status"].Value = "Deleted"; }
}"
Assaf
|
|
|
|
|
You haven't explained what error message you get.
Paul Marfleet
|
|
|
|
|
the error is appear in a messagebox:
"The following exception occurred in the DataGridView:
System.Exception:Deleted is not a valid value for int32,--> System.formatException:Input string was not in a correct formt.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.number.parseint32(string s, numberStyles style, numberformatinfo info)
at system.componentModel.int32converter.fromstring(string value,numberformatinfo format info)
at System.componentModel.basenumberconverter.convertfrom(itypedescriptorcontext, cultureinfo culture, object value)
---End pf inner execption stack trace---
at system.componentModel.basenumberconverter.convertform(itypedescriptorcontext, cultureinfo culture, object value)
at system.componentModel.typeconverter.convertfrom(object value)
at system.windows.forms.datagridviewdataconnection.pushvalue(int32 boundcolumnindex, int32columnindex, int32 rowindex, object value)
to replace this default dialog please handle the dataerror event.
"
Sorry i typed the message because i don't know how to use the dataerror event.
Thank you in advance
Assaf
|
|
|
|
|
int.Parse fails when the value you are trying to parse is the literal string "Deleted". Obviously, this string value cannot be converted to a number. You should only use int.Parse when you know that the value you are trying to parse can be converted to a number. Otherwise, use int.TryParse .
Paul Marfleet
|
|
|
|
|
(int.Parse(this.dtgCreditInfo.Rows[i].Cells["Status"].Value.ToString())
<= "-1"):
even if i put int.TryPrse i can't run there will be an error:
"No overload for method 'TryParse' takes '1' arguments"
and if i put it like this:
if (this.dtgCreditInfo.Rows[i].Cells["Status"].Value.ToString() <= "-1") because th value of dtgCreditInfo.Rows[i].Cells["Status"].Value is of type int also there will bw an error:
"Operator '<=' cannot be applied to operands of type 'string' and 'string'"
Assaf
|
|
|
|
|
Assaf82 wrote: even if i put int.TryPrse i can't run there will be an error:
"No overload for method 'TryParse' takes '1' arguments"
int.TryParse takes 2 arguments. If you had read the documentation you would know this.
Assaf82 wrote: if (this.dtgCreditInfo.Rows[i].Cells["Status"].Value.ToString() <= "-1") because th value of dtgCreditInfo.Rows[i].Cells["Status"].Value is of type int also there will bw an error:
"Operator '<=' cannot be applied to operands of type 'string' and 'string'"
Use String.Compare to compare 2 strings. However this isn't appropriate in this case and you should cast your first value to an int and do a numeric comparison.
Your questions indicate that you lack basic understanding of the .NET framework. I suggest that you master the language fundamentals before attempting anything more complicated.
Paul Marfleet
|
|
|
|
|
<br />
<br />
foreach (GridViewRow row in dtgCreditInfo.Rows)<br />
{<br />
switch (row.Cells["status"].Text)<br />
{<br />
case "1": row.Cells["status"].Text = "New"; break;<br />
case "0": row.Cells["status"].Text = "Deleted;" break;<br />
default: row.Cells["status"].Text = "Modified"; break;<br />
} <br />
}
|
|
|
|
|
GridViewRow is not a namespace and if i put DataRow instead
the error will be: "System.Data.DataRow does not contain a definition for cells"
Assaf
|
|
|
|
|
|
Which control are u using to display the data?
|
|
|
|
|
I use a DataGridView Named "dtgCreditInfo" to display the Data where they're in a DataSet
c.con.Open();
c.cmd = new SqlCommand(strcon, c.con);
c.adap.SelectCommand = c.cmd;
c.adap.Fill(c.view, "viewData");
this.dtgCreditInfo.DataSource = c.view;
this.dtgCreditInfo.DataMember = "viewData";
Color();
StatusClarification();
Assaf
|
|
|
|
|
Something like this?
<br />
foreach (DataGridViewRow row in dgvNew.Rows)<br />
{<br />
row.Cells[0].Value = "someText";<br />
row.Cells[0].ValueType = System.String;<br />
}<br />
|
|
|
|
|
ok another Error: "A value of an integral type expected"
what's mean integral type ?
it's appear on this line.
switch (row.Cells["status"].Value)
Thank a lot
Assaf
|
|
|
|
|
String CellValue = row.Cells["status"].Value;
and then: switch(CellValue)
|
|
|
|
|
I don't know what to tell it run but neither the status doesn't change nor the error message disappear.
Assaf
|
|
|
|
|
Show me the complete code of the Method you are using to change teh Value of a DataGridViewCell
|
|
|
|
|
If you don't understand what integral types are, you should go back to basics before attempting more complicated tasks. Read up on the BCL (Base Class Library).
Follow this link[^] for more information on C# data types.
Paul Marfleet
|
|
|
|
|
i am using webbrowser control in one of my projects. After I navigate to a webpage and try to exit the application I get the following error message
No Symbols are loaded for any call stack frame. The source code can not be displayes
If i press "OK" which is the only option i get this message
LoaderLock was detected
Attempting managed execution inside OS Loader lock. Do not attempt to run managed
code inside a DllMain or image initialization function since doing so can cause the application to hang.
-- modified at 8:10 Tuesday 30th October, 2007
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
I'm assuming you are running the application through Visual Studio. Check this[^] out, it may help. I have disabled the LoaderLock MDA, because if I tried to create a new folder in a OpenFileDialog (as a user) then I would get loader lock issues.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
cheers mate
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|