|
David Stone wrote:
why reference a namespace that you aren't going to use?
Actually I need to change the code and the developer who wrote it, is gone. For a person like me whose experience is in C++/MFC, the C# code looks like greek to me.
Thx for the Reflector tip.
Don't and drive.
|
|
|
|
|
Namespaces are just ways of giving classes long names. So, when you write:
namespace utility
{
class Test
{
{
}
You're really just creating a class named utility.Test.
The unit of physical organization is the assembly, which sometimes map to specific namespaces, sometimes contain more than one namespace, and sometimes contain only part of a namespace.
The answer to #2 WRT assemblies is "no", there is no overhead if you reference an assembly but don't use anything from it.
|
|
|
|
|
Hello..
I used Crystal Report which was Visual Studio .net included.
And, I'd like to make some rpt file in Runtime, not Design Time.. you know!!
However, I don't know How to deal Crystal Report in Runtime..
Is there anybody to help me?
Thanks..
I'm not who I was
|
|
|
|
|
Hi all
how to change column's header text in datagrid ??
|
|
|
|
|
DataGrid1.Columns[0].HeaderText = "FirstName";
DataGrid1.Columns[1].HeaderText = "LastName";
Alexander German
|
|
|
|
|
sorry, forgot to add, that i am talking about windows.forms datagrid, not asp.net one
in winforms u dont have columns property,
header text is set via column styles, but dont know how to get them after setting styles
|
|
|
|
|
|
Thanks Kant.
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
Hi. What's the difference between CInt(), Int32.Parse() and Convert.ToInt32() ? It looks to me that all of them are used to convert other data types to integer. So what's the difference?
|
|
|
|
|
CInt is a VB.NET thing...so I wouldn't touch that.
Convert.ToInt32() looks like this:
public static int ToInt32(double value) {
int local0;
double local1;
int local2;
double local3;
if (value >= 0) {
if (value >= 2.14748e+009)
goto i1;
local0 = (int) value;
local1 = value - (double) local0;
if (local1 > 0.5 || local1 == 0.5 && local0 & 1 != 0)
local0++;
return local0;
}
if (value >= -2.14748e+009) {
local2 = (int) value;
local3 = value - (double) local2;
if (local3 < -0.5 || local3 == -0.5 && local2 & 1 != 0)
local2 = local2 - 1;
return local2;
}
i1: throw new OverflowException(Environment.GetResourceString("Overflow_Int32"));
}
Int32.Parse() looks like this:
public static int Parse(string s) {
return Int32.Parse(s, 7, null);
}
public static int Parse(string s, NumberStyles style, IFormatProvider provider) {
NumberFormatInfo local0;
local0 = NumberFormatInfo.GetInstance(provider);
NumberFormatInfo.ValidateParseStyle(style);
return Number.ParseInt32(s, style, local0);
}
And Number.ParseInt32 is an extern method that calls into the CLR itself.
So, the Convert class does a lot of math checking and stuff like that. The Int32 implementation calls into the core of the CLR. So you may want to do some timer work to find out what is the fastest implementation.
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
Hey, .NET source code!
Where can I get it?
Thanks,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
Alvaro Mendez wrote:
Where can I get it?
Check out :Anakrino[^], or you could always try to read ILDasm.exe output.
-Nick Parker
|
|
|
|
|
A waiter asks a patron, “May I take your order, sir?”
“Yes,” the man replies. “I’m just wondering, how exactly do you prepare your chickens?”
“Nothing special, sir. We just tell them straight out that they’re going to die.”
now for the serious stuff
Is it possible and where Do I look to be able to modify the .exe file as the program is running. Such as is it possible to add the date the program was first run, and then later to be able to check that date? or maybe keep a table of High Scores? Can you tell me where to go to find information on this sort of thing
Thanks for any info you can send my way.
Matthew
"When I was young we had a quicksand box - I was an only child, eventually" - Steven Wright
|
|
|
|
|
I don't think you can modify the executable.
You can, however, put all the data you want to store and recover into an object, and use serialization to save and load it.
|
|
|
|
|
I was wondering what is the best way to deal with database connections in c# windows application.
Is it good practice or not to pass a connection string through the application and open a connection object when you need to query the database or is it better to keep a database connection open throughout the application.
It is my understanding that it is better to open a connection when you need it.
Is there any security risks in accessing a connection string through a static property in my application or is there a better way of accessing the connection string throughout the application?
I would be interested to hear any-bodies suggestions.
Thanks
|
|
|
|
|
We use a configuration file for the connection information. The strings are encrypted for security. if there is a change, we can adjust the connection strings without compiling and deploying.
ed
Regulation is the substitution of error for chance.
|
|
|
|
|
The application uses the username and password that the user provides, not a default system account. Therefore it picks up the database security/permissions to tables/views etc.
Any thoughts about securing the connection string in this sort system.
Thanks
|
|
|
|
|
Build your connection string externally and use tokens for the username and password that can be replaced through code before they are used. I like to use [%USERNAME%] and [%PASSWORD%] as my tokens.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
At the moment I have a private member variable with I store the connection string in. I make this variable accessible through a public static property.
What are the benefits of using the token methods?
Is the static property a good or bad way to store the connection string.
Getting back to the orignal post what do people think good practice is for handling database connections?
|
|
|
|
|
Are there any converters for C++ to C#?
I googled but didn't come across any.
Anybody know one?
Don't and drive.
|
|
|
|
|
- code converter ? the whole point of the CLR (Common Language run-time) is to make assemblies interoperable. Build one with MC++, another using C# and also using the first assembly. IJW!
- automatic method call converter (better known as P/Invoke) ? Not yet. Here is an interesting site[^].
|
|
|
|
|
.S.Rod. wrote:
code converter ?
Yes. Actually I need to convert the existing VC++ project to C#.NET
As I am newbie to C#, it's giving me lot of headaches.
.S.Rod. wrote:
Build one with MC++, another using C# and also using the first assembly. IJW!
Any samples?
Don't and drive.
|
|
|
|
|
Kant wrote:
Yes. Actually I need to convert the existing VC++ project to C#.NET
As I am newbie to C#, it's giving me lot of headaches.
It's good to learn, but unless it's real work, you might uselessly have to cope with structures that in C++ world are tightly coupled with memory and buffers, while .NET and C# in particular provides less access to it. (in practice, you can do anything you want, just like with C++, but you need to go pretty much hardcore and doing so there is no point in doing C# at all).
In case you want to go on with brutal code conversion, don't hesitate to have a look in MSDN first. There are a few interesting type mapping tables to learn.
Kant wrote:
Any samples?
There are simple steps.
- start VS.NET, create a MC++ user library project. Add your code. Get the assembly compiled. Let's call it Assembly1.
- create a C# project, for instance using the Windows Application template. Add a reference to Assembly1, and add using Assembly1; in your code. Doing so, automagically intellisense brings you all types from the Assembly1 metadata. Add code, compile, run. You've got your first language interoped sample!
A sample of MC++ mix mode ? Nish has one[^] for you.
|
|
|
|
|
Thanks S. Rod.
Are you by any chance MCP.net?
If not, by your replies in this board you deserve to be
Code Project MVP.net...
Don't and drive.
|
|
|
|
|
Yep, S.Rod. is definetely the man.
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|