|
I fore sure have a common task but I need some help in best practice in my topic.
How should read a file from an ASP.NET site and store it in a SQL Server.
Should I read it in as a byte[] and use varbinary(max) as database column type?
_____________________________
...and justice for all
|
|
|
|
|
d00_ape wrote: Should I read it in as a byte[] and use varbinary(max) as database column type?
Yes.
|
|
|
|
|
somewhere in my program i need that user only use keyboard and mouse be out of his or her control.
is it possible? how? please show me practical an explicit. tnx
|
|
|
|
|
Imagine you sitting in a car, and all of a sudden the radio takes over your wheel and brakes. The user wouldn't even be able to click away any popups (like the ones generated by Windows', reminding you that you need to update)
Yes, it's possible. You could prevent input by filling the screen with a large form and hiding the cursor, like a screensaver. No, that still means that I can abort the operation, since there's always a reset-key on the PC.
I are Troll
|
|
|
|
|
As the previous answer mentions removing all mouse input is not a good idea. However the best that you can achieve is to ignore mouse input messages for your app for certain conditions, for example you should still accept mouse clicks to close the application.
The simplest way to do this is to not process OnClick events etc. on your form when a specified condition is met
e.g.
private void button1_MouseClick(object sender, MouseEventArgs e)
{
if (_allowMouseClicks)
{
}
}
or even more simply if it is a different form at specific point only support Keydown etc. events...
Alternatively you could override the WndProc for your form and trap the mouse messages here and test against a condition. However overriding the Wndproc isn't that simple a task, but if its the way you want to go have a look at this[^]
|
|
|
|
|
It is generally not a good idea to attempt to force users of your software to behave the way you want them to by limiting their ability to use or control your software through conventional means. They will simply stop using your software or complain to management that it doesn’t work and you’ll end up having rewrite the code, or worse yet, have someone else rewrite your code. (I do not wish to count the number of times I’ve been tasked to do just that.) Be mindful that removing control from the user is the goal of malware and virus writers, we know how popular folks like these are.
You should create a user interface that makes it easier to enter data or interact with your controls by automatically moving the focus to the next desired control so that they don’t have to use the mouse. Sometimes it is unavoidable when certain user actions interfere with the application processes such as collecting live streaming data and moving the form can cause an interruption to the data stream. For these situations I allow the user to place or move the form when it is not collecting data, but lock it when it is. It crucial then to inform the user that this behavior exists so that it does not catch the user by surprise and have them do something like hitting the reset button because they think the PC is broke.
Rhuros first suggestion is the one that I use when someone attempts to move a form when it becomes necessary to prevent it from being moved during a critical process.
It was broke, so I fixed it.
|
|
|
|
|
S Houghtelin wrote: collecting live streaming data
On a thread I hope. That shouldn't be affected by form movement.
|
|
|
|
|
We use RS232 to collect raw A to D data from products when they are being tested for FDA compliance. The form, the Comm, and the file I/O are all invoked using their own thread. There is a momentary pause as the screen refreshes each position of the form while being moved, and depending on the machine, we've had problems when a user either moves a form to another part of the screen or decides to surf the internet or play solitaire because the testing is so boring. It is simple matter of resources, especially of time.
When a company spends in the tens of thousands of $$ for testing, it is best to mitigate any possibility of data corruption. This is mission critical stuff in the medical device industry.
The intent of my post is that a person should not prevent a user from being able to use normal interface operations such and clicking a button with a mouse or moving a form. I gave an example where a programmer could be instructed to do a little user action prevention.
It was broke, so I fixed it.
|
|
|
|
|
Hello,
Can anyone tell me how to use a List of strings inside a struct? I get the 'Object reference not set to an instance of an object.' error.
public Form1()
{
InitializeComponent();
}
struct testStruct
{
public List<string> sList
{
get;
set;
}
}
private void Form1_Load(object sender, EventArgs e)
{
testStruct aTestStruct = new testStruct();
aTestStruct.sList.Add("test");
}
Thank you!
|
|
|
|
|
You've not instantiated the List anywhere. This has nothing to do with it being inside a struct - the same would have happened if your list was inside a class.
You can fix this by first creating the List.
testStruct aTestStruct = new testStruct();
aTestStruct.sList = new List<string>();
aTestStruct.sList.Add("test");
However, a few pointers
0.1) Naming convention for C# would instruct that your property is called List instead of sList .
0.2) Be careful using structs, they have some hard to understand facets - if in doubt use a class.
0.3) Strictly speaking, a List should generally not be exposed by a public property. Consider whether the struct/class should instead expose just the interface, such as an Add method to add to an internal List.
|
|
|
|
|
struct s are meant for small value types. Both List<T> and string are reference types, and their size could potentially be very large, so I would never use them inside a struct .
|
|
|
|
|
But since they are reference types, the struct would only contain the reference..
"The actual thing" is included in the struct if it's marked ByValArray or ByValTStr or when it is a fixed size buffer[^] (I've never actually seen one of those)
|
|
|
|
|
True, I hadn't actually considered that!
I still don't like it due to the mutability implied by using a reference type inside a struct, especially with List<T> as the contents would be mutable even if the exposed list wasn't. A ReadOnlyCollection<T> would be OK I suppose, something like this wrapper...
public struct ExampleStruct
{
private List<string> list;
public ExampleStruct(IEnumerable<string> strings)
{
if (strings == null)
list = null;
else
list = new List<string>(strings);
}
public ReadOnlyCollection<string> List
{
get
{
if (list == null)
return null;
return list.AsReadOnly();
}
}
}
|
|
|
|
|
A field in a struct is mutable though, so I'm not sure what you mean..?
|
|
|
|
|
Of course, but they are generally exposed only by a read-only property. It's rare and generally not recommended to have a property with a setter or to expose the field directly in a struct.
|
|
|
|
|
I have my vs2008 c# project compiled,
when i install on win Vista, it runs fine
but does not run on win XP SP2.
please can some help me out.
thanks alot.
|
|
|
|
|
Is installed on your Windows XP system the version of the .NET Framework that your application is expecting?
|
|
|
|
|
I used VS2008 and .net 3.5 for the building of the app
on Win Server 2003 Enterprise Edition.
The .net 3.5 will not install on Win XP sp2, so i rebuild with .net 2.0
and i have installed .net 2.0 on the system
|
|
|
|
|
If you had a .NET version problem, I'd expect an error 0135.
Error 0x7b may mean: The filename, directory name, or volume label syntax is incorrect.
Could be many things, e.g. you're trying to access one of the special folders (such as Users or "Documents and Settings") without going through the proper channels (Environment.SpecialFolder). Proper try-catch and Exception reporting would take care of the details.
|
|
|
|
|
But the same project when installed on Win Vista does not generate any errors.
thanks.
|
|
|
|
|
I have found Solution to it,
I formatted my Win XP sys and reinstall the OS.
everything is working fine now.
Thanks to Everyone.
|
|
|
|
|
It's a so drastic as good solution
|
|
|
|
|
Hi,
I have to validate the control in server side and have to find which value is wrong. Ex im passing user name and password. if password is wrong it should find only the password is wrong not the user name.. Please help me..
|
|
|
|
|
Are you in correct forum?
Go here[^]
rahul
|
|
|
|
|
Hello everybody,
I am doing a application which needs to communicates with a DCOM server. I created a .NET wrapper using tlbimp.exe and referenced it in my C# program.
I then create an Object from my remote server using Activator.CreateInstance("Objectdd.obj","ServerNAME"); and cast the returned object to the correct type in the .NET wrapper class.
Until here everything is working fine, I can call method on my object from C# and the call is correctly executed on the remote machine.
The problem is, as soon as I try to connect to an event from C#, I got a System.UnauthorizedAccesException. This is strange because I can call every others method with no problems. I also tried my C# software on the server, using "localhost" as server address and I could connect to the event correctly.
Any ideas what's wrong ? Any security problems I am missing ?
Thank you,
|
|
|
|