|
I assumed he meant the icon for the program itself, that is, the one you see in Windows. I don't get it tho, what's his program going to do if the file is not there ? I just don't see any benefit.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
First of all, it's not linear, any app will use the framework, writing simple apps doesn't give you an idea of how much RAM a complex app will use. I have written a couple of apps over several years that have major functionality in them, and their footprint is < 70 MB.
sharpiesharpie wrote: how can i make my program use less memory?
Write it in C++.
Remember, RAM is cheap nowadays.
sharpiesharpie wrote: (thereby making it smaller)?.
I don't think you can, and why would you want to ? Realistically, your exe would be, what, 10k smaller ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Not really, the icon is 158Kb...so without the icon, the program would be only about 300kb big instead of 500k...and anyway I'd like to know how to do it.
so...any help?
|
|
|
|
|
Make a smaller icon.
The thing is, your program can't ship without that icon. Nor can it ship without a 20 MB runtime. So, what's the point ?
Your code does not run to show your icon in Windows, Windows does that. So, there may be a way to set it up, but it has nothing to do with C#.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
sharpiesharpie wrote: the icon is 158Kb
Then it's not an icon, or you've got a HUGE number of icons in one file. Even at 32-bits deep, a 32x32 icon would be less than 5Kb!!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
sharpiesharpie wrote: Every C# application i make takes an excessive amount of RAM
You can't just rely on the "Mem Usage" column in Task Manager to determine this. Every .NET application is handed a bit of a managed memory allocation that is controlled by the .NET runtime (CLR) itself. The Mem Usage column in task manager doesn't know anything about this memory so you're not seeing accurate and reliable results. As other people have pointed out, there are far better ways to determine the actual amount of memory your application is using.
sharpiesharpie wrote: I release every resource i use by flushing\closing\disposing\making it null and then calling the garbage collector but the app still takes like 17mb RAM...how can i make my program use less memory?
All of this is fine, except for explicitly calling the garbage collector. You really don't want to do that unless you have a very good reason to. The biggest impact you will actually see from doing that is that your applications performance will suffer. Each time the garbage colletor runs, it effectively freezes the main thread of your application so it can determine what objects are still being referenced. You actually hurt performance by making too many GC calls, so it is generally best to let the GC decide on it's own when it should run.
sharpiesharpie wrote: how can i use an exterior icon in my application, as in not compiling the program with it, but making the program use an exterior ICO file (thereby making it smaller)?.
Not sure what the point for doing this actually is. A typical icon file is small, so embedding it as the main application icon (the normal way of doing things) shouldn't cause an issue.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Hi
Hope someone to show me how to make my coding work.
I had a procedure to generate the data into dataset. By using for loop, I can use responsewrite to show the data from dataset. When I bind the dataset on gridview. It shows the following error.
The event 'System.Web.UI.WebControls.BaseDataBoundControl.DataBound' can only appear on the left hand side of += or -=
There is my code:
DataSet ds = new DataSet();
ProjectOne.AuctionItems product = new ProjectOne.AuctionItems();
ds = product.ListAllProducts();
GridView1.DataSource = ds;
GridView1.DataBound();
Thanks.
Thanks.
|
|
|
|
|
DataBound is an event (as the error indicates) and no method, so you cannot call it. You probably wanted to write GridView1.DataBind(); .
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
<br />
public partial class Form1 : Form<br />
{<br />
WebClient wc = new WebClient();<br />
public Form1()<br />
{<br />
wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback);<br />
InitializeComponent();<br />
}<br />
void DownloadProgressCallback(object sender, DownloadProgressChangedEventArgs e)<br />
{<br />
pb.Value=e.ProgressPercentage;<br />
<br />
}<br />
private void load_url(string url)<br />
{<br />
<br />
wc.DownloadData(url);<br />
<br />
}<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
load_url(tblink.Text);<br />
}<br />
<br />
}<br />
Hi,
The problem with the above code is that the following method is never called..
void DownloadProgressCallback(object sender, DownloadProgressChangedEventArgs e)<br />
{<br />
pb.Value=e.ProgressPercentage;<br />
<br />
}<br />
so the progressBar(pb) never get updated...Any Ideas what I am doing wrong?
I am using .Net Framework v 2.0
Regards
Q@!$3r
|
|
|
|
|
The documentation of the DownloadProgressChanged event clearly states that the event only occurs, if you execute the download asynchronously. Therefore, you need to replace wc.DownloadData(url); with wc.DownloadDataAsync(url); .
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
|
I need to set table header forecolor and backcolor properties:
using System.Windows.Forms;
DataGridTableStyle tableStyle = new DataGridTableStyle();
Desktop td = new Desktop();
td.GetColors(tableStyle.HeaderForeColor,
tableStyle.HeaderBackColor);
However colors are not changed since it seems that parameters are passed by value.
Which is the best practice for change colors ?
I'll prefer to execute only one query in sql server and not to add additional properties, classes and structures to code.
Desktop class GetColors method contains:
public void GetColors(System.Drawing.Color foreColor,
System.Drawing.Color backColor) {
IDataReader tableReader = ExecReader(
"SELECT hforecol,hbackcol FROM desktop");
if (tableReader.Read()) {
foreColor = GetColor(tableReader.GetDecimal(0));
backColor = GetColor(tableReader.GetDecimal(1));
}
tableReader.Close();
}
Andrus
|
|
|
|
|
AndrusM wrote: it seems that parameters are passed by value.
Not generally true. Value types are passed by value and reference types are passed by reference.
If for example you have a int parameter, any changes to this parameter won't reflect outside the method.
If on the other hand the int is a field of some class assumably called IntHolder and a method has a parameter of this class, changes to the int field of an instance of the IntHolder class will reflect outside the method, because the object is passed by reference and the parameter points to the same object as a variable outside the method.
What will not reflect outside the method is the assignment of a new instance of the IntHolder class to the parameter. To circumvent the latter restriction and those mentioned for the value types, you can declare a parameter as ref or out . In short you could say that they cause a value type to be passed by reference and in case of a reference type imagine the reference to be passed by reference. For more information on the both keywords take a look at the docs.
In your specific case, I think the easiest would be passing the DataGridTableStyle instance to the GetColors method (is passed by reference) and assign the colors retrieved from the database to the corresponding properties.
public void GetColors(DataGridTableStyle tableStyle)
{
IDataReader tableReader = ExecReader("SELECT hforecol,hbackcol FROM desktop");
if (tableReader.Read())
{
tableStyle.HeaderForeColor = GetColor(tableReader.GetDecimal(0));
tableStyle.HeaderBackColor = GetColor(tableReader.GetDecimal(1));
}
tableReader.Close();
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thank you.
GetColors() method is located in my business object class.
DataGridTableStyle is in System.Windows.Forms
My business object class is compiled to separate dll . This dll cannot have reference to System.Windows.Forms since business object class must be independent of presentation.
BO class can be used with WebForms or WebServices. In tose classes other properties need to be initialized by GetColors.
So I cannot pass DataGridTableStyle object as business class method parameter.
I also tried out and ref properties but got compile time error that out and ref cannot be used with properties.
So I do'nt have any idea. It seems that I need to create 2 color methods in my BO only for getting colors back. Very inconvenient.
Andrus
|
|
|
|
|
AndrusM wrote: It seems that I need to create 2 color methods in my BO only for getting colors back.
There are still some other options.
1. You could return an array or some other collection with Color instances from the GetColor . The first item could be the fore color and the second the back color.
2. Define a custom struct or class that encapsulates two Color instances and return an object of this struct/class from the GetColor method. In my opinion better than option 1, because this way you can access the components of the return value by name and do not need to operate with anonymous fields of a collection.
3. Circumvent the compile error by passing in objects and afterwards assign them to the properties.
Color foreColor, backColor;
td.GetColors(out foreColor, out backColor);
tableStyle.HeaderForeColor = foreColor;
tableStyle.HeaderBackColor) = backColor;
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
What is the best Code Snippets Manager? I’ve found only this:
1) Total .NET SourceBook
http://www.fmsinc.com/dotnet/SourceBook/index.asp
2) Code Library .NET
http://myweb.hinet.net/home4/s630417/CodeLib.htm
3) Code Warehouse 2007
http://www.xcca.com
|
|
|
|
|
put imagelist control on your form and add images in it as you like. now come in to the list view property using smart tag. and go to the node which u add in listview and select your imageindex property value with ur imagelist control. you can only show images in listview over listnodes
|
|
|
|
|
Sir/Madam
Protected and internal protected can be inherited in the derived classes(I mean it's functions can shared among different classes by typing internal or protected internal before the functions or variables).Then what's the difference between them.
Thanks and regards
Pankaj
|
|
|
|
|
From MSDN (do a google search on "protected internal"):
A class member can be declared as protected using the protected keyword, meaning that only derived types using the class as a base can access the member. By combining the protected and internal keywords, a class member can be marked protected internal — only derived types or types within the same assembly can access that member.
Marc
Thyme In The CountryInteracxPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
how to change input language in TextBox as like (Right-to-Left) in MS-Office Word
|
|
|
|
|
err...if it's office so why did you post it in the C# section?
and it's Ctrl+shift (on the right side) for right to left and Ctrl+Shift on the left side of the keyboard for left to right o_O
|
|
|
|
|
How to do this.
When I left click on a button to appear the context menu in the location where is the button.
C#
|
|
|
|
|
Handle the click event, get the position of the button, and then show the menu there.
A better way is to create a button that has a drop menu built into it, given that this is what the button will do.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
How do I do the following:
int i = 0;<br />
for (i = 1; i < 4; i++)<br />
{<br />
if (texBox(i).Text.Length > 50)<br />
{<br />
}
there are text boxes named textBox1, textBox2 etc.
TIA
Glen Harvy
|
|
|
|
|
for(int i = 1; i<4; i++)
{
if(this.textBox1.Text.Length >50)
{
/// do something
}
}
|
|
|
|