|
ALT + F4 wrote: dude i have confessed that i have started a new thread .. in my post...
Yes - and you said you had no answers which was a blatant untruth.
ALT + F4 wrote: wonder most of the mvp's are much bothered about the cross posts and most of them have a single answer for all the questions " What is Google "
We are bothered by the multi and cross posts because they make it almost impossible for others to find answers to problems because answers end up spanning multiple threads. This isn't a private email conversation, it's a thread that others may follow to answer issues they have.
The reason we tell people about Google is that it is very obvious that people post questions without doing ANY research for themselves, and that's just lazy.
I reckon that about 90% of the questions asked in these forums could be answered in a couple of minutes by the poster actually getting off their a*se and looking at google for a couple of minutes. It's not hard. It's not rocket science. It's just the type of thing that I do myself before I ask a question.
Do you see me or the other MVPs asking lots of questions on the forums? No? That's because we've mastered the basic technique of looking for information for ourselves; it's not because we know every class in the .NET framework inside out.
ALT + F4 wrote: Still how to get the key value ?
You still haven't explained what your problem actually is. You've thrown a disjointed and rambling thread together that doesn't tell us anything. What key? What name? Do you mean from a dictionary class? If so, take a look at this sample:
public string FindByName<T>(T dictionary, string name)
{
return dictionary[name];
}
|
|
|
|
|
As far as I can tell, a System.Windows.Forms.TreeNode doesn't have a key property.
MSDN[^] for a full listing of Methods and Properties.
Maybe use a dictionary Dictionary<int, TreeNode> TreeNodeDictionary and populate your treeview from this?
Dave
|
|
|
|
|
I know I have written the code on drag & drop feature for file interpretation in the past but can't seem to find the code. So I'm googling this online and hopefully you could give me some help with this.
This is what I wanted: I would drag & drop the multiple text files into the target application (without opening the application itself), I would show the file names that I have drag & dropped into the app.
that's all I need to do. I can do the rest of the coding.
I know I have placed the code in Main() in visual studio 2003 but where is that in visual studio 2005?!?!?
|
|
|
|
|
Blubbo wrote: I know I have placed the code in Main() in visual studio 2003 but where is that in visual studio 2005?!?!?
you have a program.cs file, it's in there.
led mike
|
|
|
|
|
right... I just found it just before you repled.
This is what I wrote... I may be wrong... pls correct me...
code shown below:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace UManager_Interpeter
{
static class Program
{
// <summary>
// The main entry point for the application.
// </summary>
[STAThread]
static void Main(string[] fileList)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run();
foreach (string file in fileList)
{
MessageBox.Show(file + " was dropped into app!");
}
}
}
}
|
|
|
|
|
P.S. How do I get the Main() pickup the name of files that I drag & dropped into app?
|
|
|
|
|
Blubbo wrote: P.S. How do I get the Main() pickup the name of files that I drag & dropped into app?
I don't understand "pickup the name of files". They are in the args array if the user dropped them on the Applications Icon in Windows Explorer.
class Program
{
static int Main(string[] args)
{
led mike
|
|
|
|
|
AAAAHH!!! Solved!!!!
Thanks a heap! You have answered my question... I knew I had to put strings[] in Main() but didn't come out right.
That was until I noticed... "static class Program"
I HAD to remove "static" to get it to work.
I had like that when I wrote it before.
Again thanks a heap!
|
|
|
|
|
I'm using MS WinForms ReportViewer control in local mode.
My application creates in-memory assembly EntityExtension dynamically.
Report definition refers codemodule Business which references to this assembly:
<CodeModule>EntityExtension</CodeModule>
<CodeModule>Business</CodeModule>
For running ReportViewer I use:
reportViewer1.LocalReport.ExecuteReportInCurrentAppDomain(<br />
System.Reflection.Assembly.GetExecutingAssembly().Evidence);<br />
<br />
reportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("EntityExtension");<br />
reportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("Business");
Trying to preview report causes error
An error occured during local report processing
[BC30007] Reference required to assembly EntityExtension
How to fix ?
How to force ReportViewer to find EntityExtension assemnly ?
Andrus
|
|
|
|
|
I have a picturebox which was created programatically and its location should be determined when the form loads.
I set the location property to a point but no matter what point is set, the picturebox appears on a fixed location when the form loads.
Below is the code:
<br />
In the picture class:<br />
<br />
public PictureBox PlaceFlower()<br />
{<br />
PictureBox flower = new PictureBox();<br />
flower.Height = 80;<br />
flower.Width = 80;<br />
flower.Image = Image.FromFile("C:\\grass.bmp");<br />
<br />
return flower;<br />
}<br />
<br />
public Point SetCoordinates()<br />
{<br />
int x = randomClass.Next(10,50);<br />
int y = randomClass.Netxt(10,50);<br />
Point p = new Point(x, y);<br />
<br />
return p;<br />
}<br />
<br />
<br />
In the form class:<br />
<br />
private PictureBox flowerPicture;<br />
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
flowerPicture = picture.PlaceFlower();<br />
flowerPicture.Location = picture.SetCoordinates();<br />
}<br />
<br />
I've checked the values of the point coordinates and they vary each time the form loads but somehow the picturebox always remain fixed at the same point on the form. I have made sure that the locked property of the control is set to false.
What is the problem with the picturebox location?
|
|
|
|
|
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
|
|
|
|