|
Add the icon to your exe project. Select the icon file in your tree view and show its properties. For the "Content Type" property select "Embedded Resource". Now, select your exe project in the tree view and show properties. Under the General tab there is an "Application Icon" property. Set this property to the file name of your icon.
I hope this helps.
Deus caritas est
|
|
|
|
|
When I try this it says that my ico file is bad, what are the properties that it requires the icon to be? I read it was picky, but the book had no data on it.
|
|
|
|
|
Try a 16x16 icon with 256 colors. That is what I am using. I suppose a 24-bit color icon would work too but I think it has to be 16x16.
Deus caritas est
|
|
|
|
|
THANKS FOR YOUR Reply !
s_mostafa_h
|
|
|
|
|
How can you extract the metadata or summary or tags of a PDF file in c#.
For example: Author, Title, etc.
-- modified at 16:42 Tuesday 14th February, 2006
|
|
|
|
|
Is there a way in C# using win32 to arrange the child windows of ReBarWindow32 (IE) like ComboBoxEx32, ToolbarWindow32 etc in same line. My purpose is to programmatically set a single line for the explorer toolbar section so that menu, tools and addressbar should be horizontally aligned.
Any help in this regard would be highly appreciated ..
thanks
Sree..
|
|
|
|
|
I hope I can explain this without sounding a complete idiot.
I have an application which has a number of classes which handle the business logic of the app and a number of forms which handle the GUI. What I want to do is use .NET remoting to have the business logic handled on a server while the clients just worry about displaying information to the user.
All of the examples I've found so far have displayed moving a simple class to a server and the server explicitly names the class when it starts up. What I need to know is how to use a single server application to distribute all of the neccessary classes for the overall application. This would essencially require the clients to be able to create instances of the remote classes and use their methods and properties.
If I'm being really thick or I seem to be trying to do something stupid then please let me know but if anyones got any ideas which might help then please let me know
Martin Keeton
|
|
|
|
|
mk20 wrote: clients to be able to create instances of the remote classes and use their methods and properties.
If this was not the case, then webservices would be an excellent choice. One thing you can do, is expose all the public instance methods as public static methods throuh webservice and pass the object on which to call the method as the parameter to the static method.
You could use remoting, but if you have multiple versions of the program, things may go out of control easily.
Using webservice:
<code>public class Employee
{
public void PromoteAsSupervisor()
{
...
}
public void GiveRaise(int value)
{
...
}
public void AssignProject(Project p, Duration d)
{
...
}
}
public class MyWebService:WebService
{
[WebMethod()]
public void PromoteAsSupervisor (Employee employee, params object[] parameters)
{
if (employee==null)
{
throw new ArguementNullException("employee");
}
else
{
employee.PromoteAsSupervisor();
}
}
[WebMethod()]
public void GiveRaise (Employee employee, params object[] parameters)
{
if (employee==null)
{
throw new ArguementNullException("employee");
}
else
{
employee.GiveRaise((int) parameters[0]);
}
}
[WebMethod()]
public void AssignProject (Employee employee, Project p, Duration d)
{
if (employee==null)
{
throw new ArguementNullException("employee");
}
else
{
employee.AssignProject(p, d);
}
}
[WebMethod()]
public void InvokeMethod (object obj, string method, params object[] parameters)
{
}
}</code>
- Malhar
|
|
|
|
|
I wanted to try and create a new DataGridViewColumnHeaderCell class that would allow me the option of having the column headers displayed vertically instead or horizontally. So I created a new class that inherits from DataGridViewColumnHeaderCell and overrode the Paint and GetPreferredSize methods. This seems to work okay so long as all my columns are visible from the start (except I can't see the result at design time, which is annoying). The problem is when I start with a column that is not visible and then make it visible later so weird things happen. The columns are set to autofit their contents but the width and height aren't getting set correctly. Here's my override for GetPreferredSize
protected override Size GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize)
{
if (!verticalText)
{
return base.GetPreferredSize(graphics, cellStyle, rowIndex, constraintSize);
}
else
{
StringFormat sf = new StringFormat(StringFormatFlags.DirectionVertical);
SizeF size = graphics.MeasureString((string)this.FormattedValue, this.DataGridView.Font, constraintSize, sf);
return new Size((int)size.Width, (int)size.Height);
}
}
Is there something I'm missing here? Is there something else I need to override? Has anybody else tried something similar?
I would at least like the width to be set correctly as I can just manually set the height of the header row to something sufficient.
Thanks
|
|
|
|
|
I'm using Reflection to extract Property/Method/Event/Field information from an assembly. Assuming that I have an object of type [Property|Method|Event|Field]Info , how do I know if the implementation is derived from the base class or if it has been overriden? I need to know how to make this distinction. I tried various BindingFlags option but no luck yet.
In the following example, when I retreive all Properties for Supervisor class, I only want "EmployeesUnderMe" returned in the collection. I should not have "Salary" and "Bonus". I SHOULD have "Bonus" if Supervisor class overrode the property. Similarly, when I invoke "GetMethods(...)" on Supervisor class, I want to be ablel to distinguish that "ToString()", "GetHashCode()" etc are defined by the "object" class and NOT the Supervisor class.
<code>
public class Employee
{
public double Salary
{
get {...}
set {...}
}
public virtual Bonus
{
get {...}
set {...}
}
public Employee()
{
...
}
}
public class Supervisor:Employee
{
public Employeee[] EmployeesUnderMe
{
get {...}
}
public Supervisor()
{
}
}
</code>
Thanks for your help.
- Malhar
|
|
|
|
|
malharone wrote: I tried various BindingFlags option but no luck yet.
BindingFlags.Declared only
I think you can also try see if the methodinfo's declaredtype and reflectedtype is the same.
|
|
|
|
|
Thank you .. that did the trick. It is much better to know the project has ~7,000 methods as opposed to 150,000 methods!
- Malhar
|
|
|
|
|
Hi,
I have to pass a native Struct from my C++ DLL into my C# program.
The problem is that the struct contains a C++ "union" member.
Can someone recommend a good way to marshal the struct into my managed code?
struct NATIVE_STRUCT
{
DWORD Value1;
DWORD Value2;
union
{
STRUCT1 Member1;
STRUCT2 Member2;
} UnionMember;
};
Thanks a lot,
Rich
|
|
|
|
|
Nevermind...I found the answer.
You have to declare the union member as a struct and use various attributes to describe the physical layout of the struct, such as the [FieldOffset()] attribute.
|
|
|
|
|
Troposphere wrote: I found the answer
There are various tricks you can use in marshalling, just as long as the layout stays the same
|
|
|
|
|
I have a C# Windows Forms app, and I want to launch a whole separate application (another .exe file) when the user clicks a button.
What class and method do I use? It should work just like Start -> Run on the Windows Task Bar.
Thanks,
Mark
|
|
|
|
|
You can use the Process class (part of the System.Diagnostics namespace)
using System.Diagnostics;
...
Process.Start("<path to .exe>");
Cheers,
Will H
|
|
|
|
|
I have this number from which I have to read first few number depending on another number. What is the best way to do that.
For example ... NumToread = 3 , number = "4567889465"
answer should newNum = 456
i can do that using for (int i=1;i<=NumToread ;i++)
does any one knows better way ...
As you can say .. I am very new to programming
Thanks
CPP
Thanks
|
|
|
|
|
You should use the String.Substring() method.
int numToRead = 3;<br />
string buf = "123456789";<br />
buf = buf.Substring(0, 3);
|
|
|
|
|
Thanks
Thanks
|
|
|
|
|
hi all!
my problem
i have a project using .NET 2 in vs.net 2005
in a DataSet i have data from an access-db.
the connection string is stored in the Properties.Settings.Default ...
what i want is that i can change the *.mdb file during runtime so that each user of the programm can set its own db file.
does anyone know how i can do this???
|
|
|
|
|
I don't see the probblem.
If the user is running his program on his computer then you can do whatever you want, no?
If you have a web page then simply store the file name in a session or something like that.
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
I have a MainForm (MDIParent), a ChildA form and a Child1OfChildA Form. I have a Panel controll on ChildA Form, How can i place Child1OfChildA on this panel controll on ChildA from?
Thanks
|
|
|
|
|
I have a c# program which retrieves registry settings & writes them out to a .reg file for storage on a network so some application settings can easily be restored after an operating system upgrade, etc. Everything was going just fine until I came across a value of type dword.
If I manually export it from the registry, this is how the name and value look.
"Number of Macros"=dword:00000012
The .GetValue method brings the value in as type System.Int32 with a value of 18 (there are 18 macros defined in that app). Is anyone familiar with this dword type and what I would convert Int32 to to get this value of 00000012?
Thanks in advance for any help!
Lara
|
|
|
|
|
The dword type is a 32-bit signed integer on 32-bit systems. The output you are getting from the registry is 0x00000012 which is 18 in hex. The registry stores dword values in hex. You could always do a decimal to hex conversion to convert 18 to its hex value.
Andy
Deus caritas est
|
|
|
|