|
In an application I am working on, I have a form that on startup, loads my addin structure and some other useful static classes. When I watch Task Manager during the form's startup, it starts up using 13500K of memory. If I minimize the form, it shoots down to 300K. Then when I restore it, it goes to only 1000K. If I start the form minimized, it still starts up taking 13500K. Then when I restore it, if jumps up 13600K. Then when I minimize it again, it drops back to 300K and up to 1000K when I restore it. Is there a way to avoid this form using so much memory on startup without having to minimize it and restore it? Thanks
|
|
|
|
|
Try using .NET framework 1.1 (This is assuming that you are using 1.0 under XP).
|
|
|
|
|
I am using 1.0 under Windows 2000 professional. However, that arises another question, how do I change VS.NET 2002 to use 1.1 instead of 1.0?
|
|
|
|
|
You can't, but you can use the command line compiler csc.exe from the .NET Framework 1.1 (SDK not required but recommended) installation directory.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Damn, you're too quick
Charlie
if(!curlies){ return; }
|
|
|
|
|
Shaun Becker wrote:
how do I change VS.NET 2002 to use 1.1 instead of 1.0?
Unfortunately, you don't. VS.NET 2002 only works with v1.0 of the framework and VS.NET 2003 only works with v1.1.
You'll have to upgrade if you want to use Visual Studio to compile for v1.1. There's nothing stopping you from compiling against v1.1 using the command-line compiler, though.
Charlie
if(!curlies){ return; }
|
|
|
|
|
You can make your apps writen in vs.net 2003 combabilitable with 1.0.
Check the Projecr Properties->Common Properties->General->Suported Runtimes
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
By, "works with", I meant "compiles to".
Yes, you can specify in your app's config file that you'll support more then one version of the .NET framework (which VS.NET does for you when you change this field in Project Properties), but that doesn't guarantee that your app will actually work with that version. You're basically just telling the CLR that it's ok to run your app with the framework versions listed.
The question I answered was about configuring VS.NET 2002 to compile to the v1.1 version of the framework, which cannot be done.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Ummm, what about trying:
lbDateTime.Text = DateTime.Now.ToString();
- Nick Parker My Blog
|
|
|
|
|
KoalaCowboy wrote:
Gang,
Background: I am trying to have a label (lblDateTime1) display DateTime.Now upon application load (Windows Form). I have done something similar in VB.NET as follows:
///VB.NET code
{
lblDateTime = DateTime.NOW.ToString()
}
///C# code
{
///Insert example here please
private void Form1_Load(object sender, System.EventArgs e)
{
textBox1.Text = DateTime.Now.ToString();
}
}
RageInTheMachine9532
|
|
|
|
|
Hello ,
Can anyone please help me, on how I go about adding a footer like the one available for the asp.net datagrid, to a windows form datagrid??
Thank you!
|
|
|
|
|
Doesn't exist on the Windows Forms DataGrid . Just add a summary row or a control (or controls) below the DataGrid on your form.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm trying to create an Interop class in C# and use it as a COM object in VBA. After numerous failed attempts in my own code I tried with a simple example. This is what I have done:
using System;
namespace BeeComTest
{
public interface ITest
{
System.DateTime GetTime();
}
public class Test : ITest
{
public Test()
{
}
#region ITest Members
public DateTime GetTime()
{
return System.DateTime.Now;
}
#endregion
}
}
Compiled it into a dll called: BeeComTest.dll
(have strong signed it)
Next I ran from the command line:
gacutil /i BeeComTest.dll
tlbexp BeeComTest.dll
Then I opened up Excel and VBA:
Selected BeeComTest from Tools/References
The VBA Code used is:
__________________________________
Dim NetTest As BeeComTest.ITest
Sub Test()
Set NetTest = CreateObject("BeeComTest.test")
//Comment have also tried setting via following
//command, same error
// Set NetTest = New BeeComTest.Test
Debug.Print ".Net server returned: " + FormatDateTime (NetTest .GetTime, vbGeneralDate)
End Sub
__________________________________
Problem:
When I run the Macro (in debug stepping through the code) I get the following errow when the object is being Set...
Run-time error '429':
ActiveX component can't create object
Then the code exits.
I have searched far and wide and can't find any useful advice/help. If anyone has any idea's or suggestions why the COM object isn't being created it would be greatly appreciated.
Many thanks,
Bee
|
|
|
|
|
|
Thanks for reply Nick Good article! I will give it a test run first thing tomorrow morning and let you know how I fare!
|
|
|
|
|
Hi
How can insert a image or read it and show in ado.net?
i want to store image (for exmaple .jpg or bmp) in database and show them in form(with which controls??)
Regards' Amirjalay
|
|
|
|
|
SQL database can accept the Binary type, which corresponds to an C# byte[]. So convert your bitmap into an array of bytes when you want to store it in the database. And when you're ready to read it from the database, construct one from the read in bytes (you should be able to use something like Bitmap.FromStream).
The graveyards are filled with indispensible men.
|
|
|
|
|
|
This has been covered many times in this forum. Please click "Search comments" above. One specific thread not so long ago can be found here[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
1. Create a binary column in your database large enough to store the picture (image is a good choice).
2. Stream the target picture (System.Drawing.Image instance or whatever) to a byte array (I generally use the System.IO.MemoryStream class and the System.Runtime.Serialization.Formatters.Binary.BinaryFormatter to create the byte stream for writing to the DB)
Example Image Encode:
=====================
Image myImage = Image.FromFile(filePath);<br />
MemoryStream stream = new MemoryStream();<br />
BinaryFormatter formatter = new BinaryFormatter();<br />
formatter.Serialize(stream, myImage);<br />
<br />
byte[] imageBytes = stream.GetBuffer();<br />
<br />
3. To retrieve the target image, load the row containing it, and get the byte array from the column containing the image data, then use the System.Drawing.Image.FromStream static method to instantiate a new Image instance.
hope this helps...
No design ever survives first contact with its users.
|
|
|
|
|
I am interested in creating an application that will write to cds from a web server but the files that it will first be in mp3 format first then the program will change the files into cda format to be burned to a cd. Could you please give me some direction?
Da Intern
|
|
|
|
|
There is library written by MS which exists in their site, its berning CD in .NET. Search MSDN for it,I don't have the link now.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
thanks for your help I have found that link now im trying to convert mp3 files to CDA files to burn onto the CD
Da Intern
|
|
|
|
|
Hello everyone,
I have a ASP.Net application which has crystal reports. For a batch process I want to create a console application in the same solution. Batch process takes about 2 or more hours to complete, console application would b a better solution as of my knowledge (if anyone has any suggestion, plz let me know). Problem is that reports exist in asp.net project, how do I use the same reports and its .cs files in the console application? I don't want to create a duplicate copy of reports.
Thanks in advance
Ali Haider
|
|
|
|
|
Sorting DataGrid BoundColumn using DataGrid.SortCommand
I have DataGrid control and I am adding BoundColumns at runtime.
My Questions are:
1) I need to sort DataGrid using DataGrid.SortCommand and **NOT** OnSortCommand as I am using CodeBack file.
2) I also need to Hide last column.
Below is code for aspx file
<%@ Page language="c#" Codebehind="DataGridSortingDemo.aspx.cs" AutoEventWireup="false" Inherits="Connection.DataGridSortingDemo" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>DataGridSortingDemo</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="DataGridSortingDemo" method="post" runat="server">
<asp:DataGrid id="DataGrid1" runat="server" AllowSorting="True" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" BackColor="White" CellPadding="3">
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#669999"></SelectedItemStyle>
<ItemStyle ForeColor="#000066"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#006699"></HeaderStyle>
<FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox id="CheckBox1" runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Left" ForeColor="#000066" BackColor="White" Mode="NumericPages"></PagerStyle>
</asp:DataGrid>
</form>
</body>
</HTML>
Below is code back (aspx.cs) file
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace Connection
{
public class DataGridSortingDemo : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
private void Page_Load(object sender, System.EventArgs e)
{
if( ! IsPostBack)
{
DataGrid1.DataSource = CreateDataSource();
DataGrid1.DataBind();
}
}
protected DataView CreateDataSource()
{
string strConnectionString = "user id=sa;password=;Database=Northwind;Server=localhost";
string strSQLQuery = "SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, 1 FROM Customers";
DataTable objDT = new DataTable();
BoundColumn objBoundColumn;
SqlConnection objSQLConn = new SqlConnection(strConnectionString);
SqlDataAdapter objSQLDA = new SqlDataAdapter(strSQLQuery, objSQLConn);
objSQLConn.Open();
objSQLDA.Fill(objDT);
objSQLConn.Close();
DataGrid1.AutoGenerateColumns = false;
for (int intCounter = 0; intCounter < objDT.Columns.Count; intCounter++)
{
objBoundColumn = new BoundColumn();
objBoundColumn.HeaderText = objDT.Columns[intCounter].ColumnName;
objBoundColumn.DataField = objDT.Columns[intCounter].ColumnName;
objBoundColumn.SortExpression = objDT.Columns[intCounter].ColumnName;
DataGrid1.Columns.Add(objBoundColumn);
}
DataView dvCommonDataView = new DataView(objDT);
return dvCommonDataView;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.DataGrid1.SortCommand += new System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.DataGrid1_SortCommand);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DataGrid1_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
Response.Write("Hi There");
}
}
}
|
|
|
|