|
Input from where exactly? From a file, from a stream, from a console application, from a form?
Without context, I can't help you. Mind you, even with context, the question may have no answer either . For example, if you're using a TextReader, you can't get at the "raw" character; it'll have been translated into a standard UNICODE character.
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|
DeanAgan wrote:
Its actually read from a textbox. Translation into a standard unicode? How do u do that? The code is suppose to block input in the textbox that exceeds 32 characters. But if I would input in Chinese characters, which has a double byte character set, then even if only 32 characters are inputted, problems would still arise coz its actually 64 characters in single byte character set. Im looking for what class to use, though I can solve it without using a class and just by looping through it.
When you are talking about the MaxLength property of the TextBox , that is refering to the actual number of character entries that are allowed, not the number of bytes. Under .NET, the TextBox 's Text property returns a String data type which is of Unicode encoding where all characters are two bytes long.
-Nick Parker
|
|
|
|
|
I heard that C# and other .Net app can be compiled as then native app,don't need to use JIT.
How?
Thank you!
Let's roll!
|
|
|
|
|
Check MSDN for ngen.exe
Alexandre Kojevnikov
MCAD charter member
Leuven, Belgium
|
|
|
|
|
It's really funny,take a look at your app build by vs.net 2003.
I have a app that is 36KB just after been build. But when I run it by double click it and close it. It's size expand to 56KB. And then I run it again,it's size shrink to 36KB,and I close it,well it's size expand to 56KB.
Why? How can it change it's size during runtime?
Well I try the same way using C# Builder. It doesn't happen.
|
|
|
|
|
I just used Borland C# Builder and use it to develop a same program that I used to in vs.net 2003. I found C# Builder compiler is much faster than vs.net. And the program size it build is smaller.
Why?
|
|
|
|
|
Are you working for Borland ?
There is no "C# Builder compiler"...C# Builder is using csc.exe just like VS.NET, so what are you saying there is impossible.
|
|
|
|
|
Are you sure! I don't think so. Just take a look of my recent message,it shows different.
Let's roll!
|
|
|
|
|
Yes, Borland licensed the standard Microsoft C# compiler for C#Builder. The timing effects you're seeing must be due to other reasons (not that I have any suggestions for you on why you're seeing a difference).
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|
[sharp] wrote:
Are you working for Borland ?
He could be but that's ad hominem and irrelevant to the truth or falsity of his claim.
[sharp] wrote:
C# Builder is using csc.exe just like VS.NET
All the more reason why he's asking the question!
Kevin
|
|
|
|
|
What is C# Builder like generally? How do its features compare with VS .NET?
Kevin
|
|
|
|
|
Thanks for all your condemn. And I do not work for Borland. I just want to know the truth.
And thank you for your words, I really learn some new English words! Like "ad hominem". I wonder if you could give me more!
Thanks again!
Let's roll!
|
|
|
|
|
"Ad hominem" is a common logical fallacy. It means saying an argument is false because the person is so and so or because he works for so and so.
For example, suppose Fred writes a paper explaining why global warming is not a severe problem. You then find out that he works for Exxon. So you dismiss his argument. That would be an ad hominem argument. To refute Fred's paper you actually have to examine his reasoning.
Kevin
|
|
|
|
|
I cannot use ildasm.exe to dasm the release version app build by vs.net 2003,but debug version can.
Is there any settings and where?
Thank you!
|
|
|
|
|
I don't have vs.net 2003 on my machine yet....but I can make a guess. I would assume that the Framework has placed the release version of the application into a different set of security settings. It would make sense that I cannot dasm a release build of an application just to insure no one can easily hack my code. It is also possible that there is some minor obfuscation going on as well.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
If it's a user manually logging in, best practice is to just say one or more are wrong and not specify which one which is an ancient method of making life a little harder for hackers.
If it's called through code and you want to report which part failed, is that information not returned by the database driver when you attempt to use it?
In any case if you want to know which one is wrong, you pretty much have to first test if the servername is valid by connecting to it then report if not, if it is valid, try logging in and report if that fails. If it's a SQL server, I suspect there is no way to determine which of the password or user id is the incorrect value since they probably follow the time honored tradition of not reporting which one was wrong for the reason above.
------------
|
|
|
|
|
I have a solution, it may not be the best, but I find it works. Say you have two input boxes, one for login, the other for password. What I did was set up a connection to the database, as usual, but, I made my query find all the usernames that matched the username inputed. If this fails, you know the username is invalid. Else, it will check the password, and you will know then if it is incorrect. Here is the code I used - try to use an error provider rather than the messagebox, but this should explain things a bit better.
string s = "Initial Catalog="+db+";Data Source="+srv+";UID="+uid+";pwd="+ps+"";
cnn.ConnectionString = s;
cnn.Open();
if(TxtUid.Text == Empty || TxtPass.Text == Empty)
{
MessageBox.Show("UserID or Password can not be left blank!","Login Fail",MessageBoxButtons.OK,MessageBoxIcon.Error);
TxtUid.Focus();
}
else
{
sda = new SqlDataAdapter("Select usrPassword, usrFullName from users where usrName = '"+ TxtUid.Text +"'",cnn);
ds = new DataSet();
sda.Fill(ds);
dt = ds.Tables[0];
if(dt.Rows.Count == 0)
{
MessageBox.Show("The username specified does not exist","Login Fail",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
else
{
dr = dt.Rows[0];
string pass = dr[0].ToString();
string name = dr[1].ToString();
if(TxtPass.Text == pass)
{
Current.Visible = false;
ApplicationData.userNameConst = TxtUid.Text;
ApplicationData.userNameFullConst = name;
frm.Show();
}
else
{
MessageBox.Show("Password does not match username '"+ TxtUid.Text +"'","Login Fail",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
}
|
|
|
|
|
Just throwing my 2.5 cents into the conversation. As mentioned earlier, it is best not to ever tell a user if the user or password is incorrect. If you do, you just cut your security drastically. If person that is trying to get into the system finds a name that is valid, then they just have to try figuring out the password. If you just say they entered an invalid user name or password, they will never know when the guess one or the other.
User friendly is fine and long as it does not hinder security.
Rocky Moore <><
|
|
|
|
|
Oh, sorry, thought you wanted to know which one was in error to display a message to the user. Not quite sure then why you would care which one was at fault.
Rocky Moore <><
|
|
|
|
|
Hi
When you show the ICQ window, if it is docked to a side of the screen, all maximized windows shrink to show it all.
How can i do something similar ?
Thanks
|
|
|
|
|
Okay -- this is not going to tell you how to do it....but you might have a direction to begin your search with this.
The ICQ process as you describe it sounds like it is implementing inside a taskbar object. Much like the taskbar in the OS and with Office explorer -- with they remain on screen, the maximized window fit to the remaining destop realty. So I'd suggest you start looking for a taskbar control and find out what its' limititations are for doing what you want.
MJ
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
Hi there,
I'm a self-learning newbie to .NET and C#, so I do not have enough knowledge to solve this problem, would appreciate any help please.
I wrote this console executable program (simply just moving files from one folder to another if some condition is matched), it runs fine on my computer but not on other computers that doesn't have the .NET Framework installed.
At first I got the error of missing mscoree.dll. After putting that file, I got a different error:
"Please set registry key HKLM\Software\Microsoft\.NETFramework\InstallRoot to point to the .NET Framework install location"
What should I do so that it will run on other computers running Windows that don't have the .NET Framework?
Thank you,
Lynn
|
|
|
|
|
lynnday wrote:
What should I do so that it will run on other computers running Windows that don't have the .NET Framework?
Install the .NET framework on them. All .NET applications must have the .NET Framework installed in order to run.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
When using params is it posible to get the name of the parameter passed or only the value?
Params is useful when you are not sure of the number of parameters, but if I'm not sure of the number, how can I be sure enough to blindly say:
FirstName = paramList[0];
LastName = paramList[1];
Thanks,
Robert
|
|
|
|
|
Nevermind,
I just spent 5 hours over-thinking the simplest thing. I'm always trying to use a ray gun.
Robert
|
|
|
|