|
stny2000 wrote: lblMsg[i].Size=new Size(352, 288);
lblMsg[i] is null, you created an array to hold objects, now you need to create a Label at each location.
And, like I said, you won't see these labels. They need to be added to the controls collection of the form. They also need a location, and text.
Christian Graus - C++ MVP
|
|
|
|
|
I can create it now and to the forms.
I forget to create the instance to the labels. i just create the instance of array...
Thanks a lot
|
|
|
|
|
Label[] lbl = new Label[10];
for (int i = 0; i < 10; i++)
{
lbl[i] = new Label();
}
|
|
|
|
|
I tried the code, but has following message prompt:
<br />
private void btnTest_Click(object sender, System.EventArgs e)<br />
{<br />
Label [] lbl;<br />
for(int i=0;i<64;i++)<br />
{<br />
lbl[i]=new Label();<br />
}<br />
}<br />
C:\docnettester\docnettester\Form1.cs(263): Use of unassigned local variable 'lbl'
thanks your reply
|
|
|
|
|
Label[] lbl = <big>new Label[10];</big>
for (int i = 0; i < 10; i++)
{
lbl[i] = new Label();
}
|
|
|
|
|
O....I know now...forget to create the instance for array
Thanks a lot
|
|
|
|
|
Greets everyone!
Am searching for a plugin or something else which allows me to communicate via C# (VS 2005) to a program which implements the CORBA interface. Have read about JANEVA, but Borland does not allow to download it any more. Which other possibilities are there? (I must admit at this very moment I have no idea how this should exactly work, hope it´s kind of dll which can be instanced. If anyone is experienced with this, I would really apreciate to read about this)
Thanks for your help.
|
|
|
|
|
so you want to communicate java systems with C# isnt' it ?
why don't u develop WSDL contracts implementing webservices ?
have you looked at those options ?
or am I missing something here?
Paresh
|
|
|
|
|
i created a static variable in a static class
for testing i stored around 50 MB data in it at runtime and then assign it to null
but the ram used is not freed even when i called Garbage collector
and when it replaced data with some other data the it just increased amount of ram used instead of freeing resources from the variable and load fresh data
|
|
|
|
|
i think i get the solution
there is a texture.dispose();
however the problem still exist that when i assign it to null then why don't the resources get free even after gc.collect
|
|
|
|
|
Amar Chaudhary wrote: gc.collect
This is always a bad idea.
The gc marks things according to how long they were in memory. If you held something for a while, it won't collect it necessarily, even if you call gc.collect. Dispose is the correct way to deal with objects that offer it.
Christian Graus - C++ MVP
|
|
|
|
|
How are you determining that "the ram did not get freed"? Are you looking at the CLR heaps? Or are you just expecting Task Manager to reflect the change (it won't)?
The only valid way to tell what is going on is to look at the CLR GC generation counts and the reachable/unreachable object counts. Once the CLR has to allocate more memory to the heap, it won't release it back to the OS until termination (unless the OS becomes starved for ram).
|
|
|
|
|
i did it with task manager
Rob Graham wrote: it won't release it back to the OS until termination
yes it may be so but when i dispose the same texture it reflects the changes (as i said i used 50 mb (approx) data )
and when i do
tex = new texture[0]; //it was a array of 10 or assign each individual item in it to null
and again assign the same thing in it the ram is increased by the same value every time
(in form ram+= )
and will you please guide me how to look at CLR heaps Thanks
|
|
|
|
|
TaskManager is not a very accurate tool when it comes to measuring managed memory consumption. As Rob said, you need to watch the CLR heap size instead. Perfmon (type perfmon.msc at the command prompt) has a set of counters that allow you to do precisely that. Right click on the graph, click "Add Counter", select ".NET CLR Memory" in the "Performance Object" drop down list and you'll see a list of managed memory parameters, which you can then select to monitor them for your process.
|
|
|
|
|
Setting an object null does not immediately cause it to be garbage collected, nor finalized (CLR calls dispose). Dispose is intended to release non-managed resources, independently of garbage collection, which is likely what you are seeing in TM when you call dispose yourself. when you set the array to null, or reallocate, the original array is de-referenced, and made elligible for GC. on the next GC cycle, it will be promoted to a second generation object, and be placed on the finalization queue. On the next collection, GC will call dispose (finalize) and collect the managed memory. So, sooner or later, GC would free memory that was allocated, but you can't predict when (which is why it is called non-deterministic). As Sentil said, use the CLR performance counters to observe GC actions.
This article[^] Has a good description of how all this works.
|
|
|
|
|
thanks this is very useful information wish more people to go through it
you have good knowledge of the topic why don't you write articles
|
|
|
|
|
|
hi
i have a table in my dataset and i create another datatable as "dt",i want to copy a few rows from myDataset.Tables[0] to dt but the following error shown me :
This row already belongs to another table.
how to solve my problem ?
My code is :
foreach (DataGridViewRow _gridViewRow in dataGridView1.Rows)
{
if (_gridViewRow.Cells[0].Value != null)
{
if (_gridViewRow.Cells[0].Value.ToString() == "True")
{
//_gridViewRow.Visible = true;
//c++;
DataRow row = ds_zamin1.Khaneh_1.Rows[_gridViewRow.Index];
ds_zamin1.Khaneh_1.Rows.Remove(row);
dt.Rows.Add(row); //error in this line }
}
}
this.dataGridView2.DataSource = dt;
|
|
|
|
|
Use DataTable.ImportRow() instead.
Regards
|
|
|
|
|
hi
thanks .. it is works, but a Bigger Problem :
when i set Datagridview2.Datasource to dt, nothing occured and imported rows does not appear in datagridview2, how to solve this problem ?
My Code Is :
DataTable dt = new DataTable();
foreach (DataGridViewRow _gridViewRow in dataGridView1.Rows)
{
if (_gridViewRow.Cells[0].Value != null)
{
if (_gridViewRow.Cells[0].Value.ToString() == "True")
{
DataRow row = ds_zamin1.Khaneh_1.Rows[_gridViewRow.Index];
dt.ImportRow(row);
}
}
}
this.dataGridView1.DataSource = dt; // Nothing Occured
|
|
|
|
|
First allow me to put a small touch on your code -Don't forget to add the pre tags next time please;)-
DataTable dt = new DataTable();
foreach (DataGridViewRow _gridViewRow in dataGridView1.Rows)
{
if (_gridViewRow.Cells[0].Value != null && _gridViewRow.Cells[0].Value.ToString() == "True")
dt.ImportRow(ds_zamin1.Khaneh_1.Rows[_gridViewRow.Index]);
}
this.dataGridView1.DataSource = dt;
If dt is a local variable, then it'll be destroyed after the current method is finished which for sure wil simply make nothing.
Regards
|
|
|
|
|
first:clone the dataset.table[0] to dt,
seconde is your code.ok
Maybe
|
|
|
|
|
Hi!
I need to load a DataGridViewComboBoxCell from dynamic SQL data and the other DataGridViewTextBoxCell from another SQL datasource.
Thats not it... i need also be able to edit one single value from it.
For exmple, I need to be able to select some item or insted be able to insert a new value to get from some insert qerry. All this for earch row in a normal DataGridView Component from Visual Studio .Net 2005
tnks!
___________________________
vykom's best.
Free your mind! use GPL.
up to open source!!!
|
|
|
|
|
If you need to populate a DataGridView from multiple sources, you can do that using DataBindingSource with no problem. You can either specify a data member for each column manually, or I'd go for making a DataView with the custom view you want to make using a SQL SELECT statement.
About your second question, I don't really understand what you want to do. Maybe you could give an example or be more specific?
Regards
|
|
|
|
|
well, tnks for that.
About the second question, what I need is something like this:
Some user, can manually select an item loaded in the DataGridViewComboBoxCell, but, in any case, he can manually insert a value typing it too.
That's why I can't explicity load all items from a BindingSource or TableAdapter normally, because I wouldn't add or edit any item from the control.
Y try getting the full action over "mouseclicked" and "itemselected", but I couln't add an item in the combo .... exception released because i'm trying to edit all the concurrency of the BindingSource. And also loading the commbo manually, I couln't draw a simple TextBox in the place of the ComoboBoxCell..
It's kind of tricky.
(sorry my english)
___________________________
vykom's best.
Free your mind! use GPL.
up to open source!!!
|
|
|
|