|
thx for the answer!
I'm not in the business programming/web programming yet( in 3 years when i have finished university ). So I don't think I'll have a great use of it. I'll stick to C++ for the moment. I've actually discovered .NET just after i posted this message. It seems interesting but coming from microsoft....i'm have some doubts. Well, I should maybe try it to see what the new baby is capable of.
|
|
|
|
|
It never hurts to expand your skill set, one thing I liked to do was take problems given in uni and try to work them into my programming.
In my Introduction to Error Correcting Codes class I wrote a program in C# to find the coset leaders for a given problem (64 possible cosets i had to find 63 vectors in the set, 256 or 512 vectors total).
Good Luck,
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Hi,
I’m trying to use wndProc for ListView in C#.
LRESULT CALLBACK MainWndProc( HWND hWnd,
UINT uMessage,
WPARAM wParam,
LPARAM lParam)
{
switch (uMessage)
{
case WM_NOTIFY:
ListViewNotify(hWnd, lParam)
}
}
LRESULT ListViewNotify(HWND hWnd, LPARAM lParam)
{
//Any idea how can I write following code in C#.
//C Code is
LPNMHDR lpnmh = (LPNMHDR) lParam; // Translate in C#???????
}
Any help on this would be great.
|
|
|
|
|
Is there a way to have one connection string, in this case an OleDbConnection to an Access database, that can be accessed globally from more than one class? Is it possible to have one connection string that covers an entire application? Thanks for any help.
Kyle
|
|
|
|
|
I use a static method to retrieve my database connection:
using System;
using System.Data.SqlClient;
namespace DbUtils {
public class DataTools
{
public static String username = null;
public static String password = null;
public static SqlConnection GetConnection()
{
String connection = "database=mydb; network address=myserver; network library=dbnmpntw; "
if(username != null)
connection += "user id=\"" + username + "\"; ";
if(password != null)
connection += "password=\"" + password + "\"; ";
return new SqlConnection(connection);
}
}
}
And then elsewhere in your app you just get a connection like:
SqlConnection conn = DbUtils.DataTools.GetConnection();
--
Peter Stephens
|
|
|
|
|
That really helps me! Thank you. Kyle
|
|
|
|
|
I have a windows service application. but I installed the latest version of .NET framework (they call the "FINAL VERSION") on a different machine and try to install this service (created in an older version, not very old though, one with came along with VS.NET beta 2).
The installutil says that it is not able to recognize the installers. Isnt this nuts? Why do they change the way it works? Is there any documentation on this, how the installer works in the final version? Can someone help me on this?
omkamal
|
|
|
|
|
You'll have to recompile your code with the final version (1.0) of the SDK (all 120 MB of it). Before you can use it on a 1.0 machine.
Versions after 1.0 should have to problem handling 1.0 code however (so you won't go through this again when 2.0 comes out).
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Upon first pass it appears as thought the dotnet framework is no longer embedded and automatically deployed with VS.NET microsoft installer deployment projects as it was in Release Candidate 1. I was hoping not to have the user have to run the dotnetfx.exe redistributable separately before they could install the .NET application I have written.
When I compile a deployment project I get the warning: "This setup does not contain the .NET Framework which must be installed on the target machine by running dotnetfx.exe before this setup will install. You can find dotnetfx.exe on the Visual Studio .NET 'Windows Components Update' media. Dotnetfx can be redistributed with your setup."
Does any know a way to have the dotnetfx.exe automatically run when a new .NET application is being installed? Any ideas on other options?
Kyle
|
|
|
|
|
Thomas Scheidegger had this to say about it on the DOTNET mailing list.
MS did a last-minute change in deployment strategy!<br />
<br />
.NET Framework Deployment Guide:<br />
<br />
<a href="http://msdn.microsoft.com/library/en-us/dnnetdep/html/dotnetframedepguid.asp" target="_blank">http:
<br />
and in special for VS.NET and .msm:<br />
<br />
<a href="http://msdn.microsoft.com/library/en-us/dnnetdep/html/vsredistdeploy.asp" target="_blank">http:
<br />
the solution seems to be a 'Bootstrapper' hack.....<br />
<br />
<br />
Thomas
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
That was very helpful. Thank you. Kyle
|
|
|
|
|
object obj = Activator.CreateInstance(type);
arraylist.Add(obj);
generates the following compile error:
Value null was found where an instance of an object was required.
Yet this code works fine so its obvious that obj is not null...isnt it ?
object obj = Activator.CreateInstance(type);
IInterface i = (IInterface)obj;
i.InvokeAMethod();
|
|
|
|
|
have you done
arraylist = new System.Collections.ArrayList; ?
wouldn't be the first time I've forgotten to do that
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
I CANT BELIVE THAT!!!
how did i miss that
|
|
|
|
|
Anyone know of any good articles on printing, wrapping text and pagination, etc.?
Kyle
|
|
|
|
|
Try www.gotdotnet.com.
They have some useful articles on GDI+. From my experience I would recommend using GraphicsUnit.Document (1/300 inch) as a scale mode. I tried using pure inches and encountered terrible roundoff errors in the GDI matrix transformations.
One issue I was not able to overcome with managed code was the printer's page offset. (0,0) is at the upper left corner in the print preview, but offset by some arbitrary amount when printing (presumably different for each printer.) This information can be found out with Win32, but seemingly not with Managed Code.
--
Peter Stephens
|
|
|
|
|
Because I also had trouble with inches and printers have default page units of GraphicsUnit.Display that is what I am using. Your recommendation seems to make more sense as it offers finer control so I think I will give it a try. I'll also check out the gotdotnet articles. Thanks.
Would you like the unmanaged code in C# to obtain the unprintable margins? I can copy and post it for you if you need it.
Thanks again, Kyle
|
|
|
|
|
I'm not currently working on printing, but I will probably do some in the future. So sure, if you have the Unmanaged Code handy, I can store it for future reference...
Thank you
--
Peter Stephens
|
|
|
|
|
Here's the code:
// Reference InteropServices;
using System.Runtime.InteropServices;
// define constants for the physical offset values
private const int PHYSICALOFFSETX = 112;
private const int PHYSICALOFFSETY = 113;
// Define DLL and prototype the Win32 API method
[DllImport("gdi32")]
public static extern int GetDeviceCaps(IntPtr hdc, int cap);
// get the device context handle from the graphic object that is being printed
// call GetDeviceCaps to return the offsets
// release the handle to the device context
int unprintableleft, unprintabletop;
IntPtr hdc;
hdc = e.Graphics.GetHdc();
unprintableleft = GetDeviceCaps(hdc,PHYSICALOFFSETX);
unprintabletop = GetDeviceCaps(hdc,PHYSICALOFFSETY);
e.Graphics.ReleaseHdc(hdc);
MessageBox.Show("Unprintable: " + unprintableleft + " " + unprintabletop);
Kyle
|
|
|
|
|
Does anyone know what all the lag is about when I run my C# console apps? It just seems to take ages before it actually start the programs. Is there anything I can do to minimise it?
Thanks in advance
Windows 98 (win-doze): a 32 bit Extension to a 16 bit Graphical Shell of an 8 bit Operating System originally coded for a 4 bit Processor by a 2 bit company that can't stand one bit of competition.
|
|
|
|
|
What you're experiencing is the JIT taking place. To get rid of it you can run ngen.exe on your executable to pre-JIT it. I think to run ngen you might have to sign your exe. sn -k keyfile.snk creates your keyfile, the docs tell how to get it signed (I'm not at my PC right now otherwise i could give you the code for it )
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Thanks matey, ngen ran without signing the exe. And now my app runs immediately. I think all this stuff should go into an FAQ somewhere. I wonder how many other people are puzzled by the same stuff.
Thanks again, you're a great help
Windows 98 (win-doze): a 32 bit Extension to a 16 bit Graphical Shell of an 8 bit Operating System originally coded for a 4 bit Processor by a 2 bit company that can't stand one bit of competition.
|
|
|
|
|
Hi,
When I call the Directory.GetFiles() funcion, it returns an unsorted string array.
I would write a sorting algo, but if theres a class that can sort a string array can someone let me know.
cheers
|
|
|
|
|
You can use the static method System.Array.Sort(). This method has overloads for sorting an array in place, for customizing the sort order (non-case sensitive, etc.), or for just sorting sections of an array. The sorting algorithm employed is QuickSort.
--
Peter Stephens
|
|
|
|
|
Is it possible to create a toolband with C# similar to http://www.codeproject.com/useritems/toolband.asp
|
|
|
|