|
Hi,
some comments:
1.
your names are quite confusing, you should change them:
PlaceFlower() does not place a flower, it creates a PictureBox that holds a flower,
but it does not make it visible and does not set its location; GetFlowerBox() is a better name.
SetCoordinates() does not set coordinates, it creates and returns a Point, but does
not do anything with the Point. GetRandomPoint() would be a more appropriate name.
Choosing proper names will help you in understanding your own code, today and in future.
2.
your code is not complete, and the problem is likely to reside it what is not shown.
My best guess is you have two PictureBoxes:
- if you already see a flower, it is not the one from flowerPicture; I suspect you
have some other PictureBox that shows the flower you see, and is not affected by
your attempts to move it;
- the flowerPicture PictureBox, as far as the code shows, never becomes visible, since
it is not added to the Controls property of any Container or Form.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Yup, I guess you are right. When I added the control to the form, it can work now. Thanks~
|
|
|
|
|
Hi, I have an application that was coded in VS 2003 (C#) and converted to 2008. Most everything is working fine however, I have one annoyance. When the applicaiton is run the buttons and controls maintain the squared off edges that were present in VS 2003 (this is fine); however, on my machine when I load a form in the designer I see the newer rounded (and smaller) controls. So when I am making UI changes I don't get to see how things are really going to look until I run the application. Is there a setting somewhere that I need to change for this? There are 2 of us who are coding on this project and the other coder doesn't have this issue. He sees the controls with the older style in both desing and runtime. Any help would be greatly appreciated.
Oh by the way, we are compiling to .net 2.0
Regards,
Sean
|
|
|
|
|
try and see that Application.EnableVisualStyles(); is executed in Main() before you run your form. Had the same problem before, noticed that the styles weren't enabled and it was painting the old 'square' button look.
|
|
|
|
|
HI,
I'm Tring to Usae the :
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_BIOS");
And
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_TemperatureProbe");
But I Do Not Get Any Resaults
ANYONE?
is there another way to Get The CPU temperature
Have Fun
Never forget it
|
|
|
|
|
Manufacturers are not expected to provide WMI data providers for everything they make. You' not getting any results because either you did not install the WMI providers supplied with your motherboard or they simply don't exist. If they don't exist, you can't use WMI to get the CPU temp.
|
|
|
|
|
AH O.K,
So Waht i need is to find if my M.B Supports WMI Data and have the Driver
THANKS
Have Fun
Never forget it
|
|
|
|
|
Da how can I see the details of an assembly ( dll or exe)
I tried in notepad…
Do we have any method to list out the methods declared in the assembly?
My small attempt...
|
|
|
|
|
use the Lutz Roeder .net reflector or add the assembly to project visual studio or/and use object browser to explore its contents or
....
f(yf) = yf
|
|
|
|
|
Hi All,
I have some foreach loops like this:
foreach(Datarow Head in mydt.Rows)<br />
{<br />
foreach(Datarow Sub1 in mydt1.Rows)<br />
{<br />
}<br />
<br />
foreach(Datarow Sub2 in mydt2.Rows)<br />
{<br />
}<br />
}
Now what should i use that when my condition within foreach(Datarow Sub2 in mydt2.Rows) is true , my programe most go back and continue the begin foreach: foreach(Datarow Head in mydt.Rows)
Thanx.
|
|
|
|
|
I think the word you are looking for is
break;
Just do this:
if(someCondition.IsMet)
{
break;
}
Simon
|
|
|
|
|
use exit , continue , break .improvise. and never modify the collection while you are in the loop
f(yf) = yf
|
|
|
|
|
i tested continue, return, break. None of those gives me the right output
|
|
|
|
|
As Simon said break; should do it.
if you are in a loop and you have hit your required condition "break" will exit the current loop. (or better re-design\refactor your code so you dont have so many loops)
modified on Wednesday, April 2, 2008 10:58 AM
|
|
|
|
|
Try the following example based on the code structure you gave:
int[] mydt = new int[] { 2, 0, 1 };
object[] mydt1 = new object[] { new string[] { "Aa", "Ab", "Ac" }, new string[] { "Ba", "Bb", "Bc" }, new string[] { "Ca", "Cb", "Cc" } };
object[] mydt2 = new object[] { new string[] { "Aa", "Ax", "Ac" }, new string[] { "Ba", "Bb", "Bx" }, new string[] { "Cx", "Cb", "Cc" } };
foreach ( int Head in mydt )
{
Console.WriteLine("Head = {0}", Head);
string[] mydt1Rows = (string[])mydt1[Head];
foreach ( string Sub1 in mydt1Rows )
{
Console.WriteLine(" Sub1 = {0}", Sub1);
}
string[] mydt2Rows = (string[])mydt2[Head];
foreach ( string Sub2 in mydt2Rows )
{
Console.WriteLine(" Sub2 = {0}", Sub2);
if ( Sub2.IndexOf("x") != -1 )
{
Console.WriteLine(" break: in order to skip to next Head");
break;
}
}
}
It should give you
Head = 2
Sub1 = Ca
Sub1 = Cb
Sub1 = Cc
Sub2 = Cx
break: in order to skip to next Head
Head = 0
Sub1 = Aa
Sub1 = Ab
Sub1 = Ac
Sub2 = Aa
Sub2 = Ax
break: in order to skip to next Head
Head = 1
Sub1 = Ba
Sub1 = Bb
Sub1 = Bc
Sub2 = Ba
Sub2 = Bb
Sub2 = Bx
break: in order to skip to next Head
showing that the break is properly ending the inner Sub2 loop when the condition occurs (Sub2 contains 'x').
Clive Pottinger
Victoria, BC
|
|
|
|
|
I am novice to DB operations. I had some question.
In a DB there are 3 tables Company, Customer, Contact.
Company feilds: Cid, CName,
Customer feilds: custID, custName, Cid(same as company), etc......
Contact feilds: conID, conName, custID(same as customer), etc.....
This approach i m using:
1) loading the company table on form_load event, and binding CName to combobox.
2) On combBox Selection_change_commited event loading data from Customer table where Cid is same. After filling the DataTable calling the BindCust method to bind data.
===Here i m facing a problem, when 1 selects the name from cmbBox, the corresponding feilds of Customers table loads only for 1st tym. If i select name 2nd tym the data remain unchange. what is wrong?
I also use cmbBox selection_change event, in this data is not loading at all.
3) then i create a currency manager of Customer datatable, on the cm_Position_change event i am loading contact table and after that calling BindContact method.
Plz, guide me.
a) Is this approach is Ok?
b) If not. then plz tell/guide me, how to acheive the same.
I want
If user selects a Name from cmbBox, then all customers that name appears,
then against this customer all contacts details appears.
Thanks to all.
|
|
|
|
|
Is there no standard tree structure supplied with .Net? If not, any recommendations on a third party one?
|
|
|
|
|
Do you mean TreeView, or a hierarchical structure of items? If the hierarchical structure then I have one knocking around somewhere you can have. Let me hunt it out and you can have a copy - I'll probably post it on my blog.
|
|
|
|
|
The "hierarchical structure of items" one
|
|
|
|
|
Is a red-black tree OK with you?
|
|
|
|
|
|
|
|
hi
In my form there is tree view name Account_Tree at the time of adding nodes to the tree view i have done this
Account_Tree.Nodes[0].Nodes.Add("1","Acc");
Now i want to get the Key value
How to do this ?
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
|
|
|
|
|
I don't have VS running at the moment....but here are the steps to answer your own question.
Maybe you want to walk through all added nodes so you start building some kind of structure.
foreach ( TreeNode node in Account_Tree.Nodes[0].Nodes )
{
}
Now inside that loop you are going to rip out the value of one of the fields so
inside the foreach loop you would type node.
Now browse the Intellisense and read the various descriptions to find which property returns the data you want.
|
|
|
|