|
That sounds like a bad idea. You will have to make sure that all the forms are the same size and appear in the same spot, or the user will get confused. For this kind of scenario (one form at a time), there is the TabControl you can use to fit multiple forms in one window. Then, you could add a button "next", which would switch to the next tab (maybe storing that forms data first) and a button for the "previous" step. With this functionality, the user could simply change between forms using either the tab control or the prev/next-buttons.
Trust me, forcing the user in a too tight set of constraints WILL upset him. After all, we are talking USER interfaces here. There is a reason this isn't called a "DEVELOPER interface".
|
|
|
|
|
Thank you Sebastian, I appreciate your suggestion. I like your idea and I think I will go with the tab control because that will reduce a lot of other work as well of hiding forms and reshowing forms with the previously entered data, etc.
Thanks!!!
sasa
|
|
|
|
|
Hello
With all respect and regards to Sebestian, the model you are asking about is not a bad idea at all. It's caled the wizard UI model, and it's already implemented in almost all installers and several other well known applications, when simplifying a task for the user is required.
Anyway, there are two ways that I know of to implement this model.
1- As you suggested. To make a form for each step, and hide =/show each form according to the user's choice. Two scenarios:
You are implementing a wizard in your main form. In this case you will make Form objects in your main Form's class, like this:
Ps. a- Step1Form is another form that you design in another file.
b- Make in each step the back button as Cancel, and next as OK buttons.
public partial class MyMainForm : Form
{
private Step1Form Step1;
private Step2Form Step2;
private Step3Form Step3;
MyMainForm()
{
Step1 = new Step1Form()
Step2 = new Step2Form()
Step3 = new Step3Form()
}
public void MyWizardMethod()
{
this.Hide();
while(true)
{
if(Step1.ShowDialog() == DialogResult.Ok && Step2.ShowDialog() == DialogResult.Ok && Step3.ShowDialog() == DialogResult.Ok)
{
break;
}
else if()
{
}
else
continue;
}
this.Show();
}
}
NB. If you don't have a main Form for the wizard, you can make the last step -ie. the result- as the main form.
2- Second way of making a wizard is;
a- Make a single form
b- Put each step's controls in a panel or a groupbox
c- Show/Hide according to the current step
Regards
|
|
|
|
|
Hi all,
Is there a way for a process running to know if a specific IPC channel or object type has been IPC - registered (registered well known service type) by a server process running in the same machine ?
Thanks a lot,
Juan
|
|
|
|
|
Hello.
I've have this little method (yes - I know it makes no sense - but it is a test):
<br />
public void AddNumbers()<br />
{<br />
Int16 a = 2;<br />
Int16 b = 4;<br />
Int16 c = 6;<br />
<br />
Int16 result = a + b + c;<br />
}<br />
The above will not compile. I get the CS0266 compiler error: Cannot implicitly convert type 'int' to 'short'. An explicit conversion exists (are you missing a cast?)
But this will:
<br />
public void AddNumbers()<br />
{<br />
Int16 a = 2;<br />
Int16 b = 4;<br />
Int16 c = 6;<br />
<br />
Int32 result = a + b + c;<br />
}<br />
Now why is this happening? I've checked the IL code for the method, it looks like this:
<br />
.method public hidebysig instance void AddNumbers() cil managed<br />
{<br />
.maxstack 2<br />
.locals init ([0] int16 a,<br />
[1] int16 b,<br />
[2] int16 c,<br />
[3] int32 result)<br />
IL_0000: nop<br />
IL_0001: ldc.i4.2<br />
IL_0002: stloc.0<br />
IL_0003: ldc.i4.4<br />
IL_0004: stloc.1<br />
IL_0005: ldc.i4.6<br />
IL_0006: stloc.2<br />
IL_0007: ldloc.0<br />
IL_0008: ldloc.1<br />
IL_0009: add<br />
IL_000a: ldloc.2<br />
IL_000b: add<br />
IL_000c: stloc.3<br />
IL_000d: ret<br />
}
As far as I can see IL adds the numbers as ldc.i4. is this integer 4 byte? Because if it is, why does it not get the numbers from ldc.i2. instead? Since my variables are of the type Int16?
Can anybody tell me why?
Best regards
Soeren
|
|
|
|
|
Bad Robot wrote: As far as I can see IL adds the numbers as ldc.i4. is this integer 4 byte? Because if it is, why does it not get the numbers from ldc.i2. instead? Since my variables are of the type Int16?
Can anybody tell me why?
That is what is happening. It's needed because adding two int16's could overflow and require an Int32 to store the result. Forcing an explicit cast is intended to make the developer aware of the failcase at design time rather than having a user discover it via a runtime exception.
|
|
|
|
|
dan neely wrote: That is what is happening. It's needed because adding two int16's could overflow and require an Int32 to store the result.
This is obviously not the case here, see my post below. Using the unchecked keyword also fails.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
This is strange indeed. The compiler also complains when using the unchecked keyword.
I googled a bit and found out that ldc only supports i4, i8, r4 and r8 as parameters (i=int, r=float), which would mean that Int16 are internally interpreted as Int32 , can anyone confirm this?
The "ldc" instruction can support a 4-byte integer (i4), an 8-byte integer (i8), a 4-byte float (r4) or an 8-byte float (r8).
-> source
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
That makes sense considering processor registers, supported by the .NET Framework, are either 32 or 64 bits wide.
According to the documentation for the LDC_I4[^] and LDC_I8[^] opcodes, yes, this is the case. Integers of any size are stored in either 4 or 8 bytes.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
short s are promoted - converted - to int s before performing calculations. This is true in C and C++ as well as in C#. Therefore the type of 'a + b' is Int32 . When you then try to assign the result of the expression (which is Int32 ) back to an Int16 , there's a type mismatch, which produces the error message.
|
|
|
|
|
I have this code:
Stream s = File.Open(@destinationDirectory + tableName + ".cs", FileMode.Create);
StreamWriter sw = new StreamWriter(s);
CodeGeneratorOptions cop = new CodeGeneratorOptions();
CodeNamespace cdm = new CodeNamespace(nameSpace);
CSharpCodeProvider cscProvider = new CSharpCodeProvider();
ICodeGenerator cscg = cscProvider.CreateGenerator(sw);
CodeTypeDeclaration ctd = new CodeTypeDeclaration(tableName);
ctd.IsClass = true;
ctd.TypeAttributes = System.Reflection.TypeAttributes.Public;
This works just fine for creating the class.
But, I want to declare this a partial class for this reason. I have a main code file with methods and what not. But, I am creating the properties for the class dynamically. So I want this class to be a partial class file that is never opened and can be replaced any time.
So I need to say "public partial class". Does anyone know how?
Thanks,
Nick
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
nevermind, its a boolean property in the code type declaration
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
Happens to me all the time: ask a question to which I didn't bother enough/was too deep thinking to quickly find the answer myself.
Best regards...
Vini - Csharpian
|
|
|
|
|
Hello,
I have been trying to modify the available .NET WMI examples on The Code Project so that I could uniquely identify a pen-drive (usb key). Unlike the hard disks, pen drives do not expose a property like UniqueID. Any ideas of what I could use to uniquely identify it?
I have already read and tried the "normal" examples available on .NET's WMI.
Thank you all in advance,
Vini - CSharping a lot
|
|
|
|
|
Hi!
I think Win32_DiskDrive.PNPDeviceID is unique. I tried it with two idential usb sticks and they gave different PNPDeviceID's.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
mav.northwind wrote: Hi!
I think Win32_DiskDrive.PNPDeviceID is unique. I tried it with two idential usb sticks and they gave different PNPDeviceID's.
Hi Mav... Tried that but unfortunately I think I couldn't use that, as windows gives your pen-drive a different PNPDeviceID each time you plug it in. =) I needed something that could tell "Oh, this is Jimmy's pen-drive" for instance. I am developing an app in which, along with user and password, the client system has to provide an unique ID for the pen-drive being used with the app. Any other ideas?
Regards...
Vini
|
|
|
|
|
You might be able to gleen something useful from this[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
ReHi!
At least with the 4 sticks (3 different brands) I tried it with, they all kept their PNPDeviceID, even when I plugged them into another computer.
But your mileage may vary...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
mav.northwind wrote: At least with the 4 sticks (3 different brands) I tried it with, they all kept their PNPDeviceID, even when I plugged them into another computer.
But your mileage may vary...
You're quite right, mav... Looking through msinfo32.exe I could check that it remains the same, actually. I also tested on another workstation.
Thanks a lot for your help.
And btw: the link that Dave (if Im not wrong) posted is very nice. If you wanna take a peek:
http://msdn.microsoft.com/coding4fun/someassemblyrequired/isthatyou/default.aspx
Cheers,
|
|
|
|
|
Marcos Accioly wrote: And btw: the link that Dave (if Im not wrong) posted is very nice. If you wanna take a peek:
http://msdn.microsoft.com/coding4fun/someassemblyrequired/isthatyou/default.aspx
Yup, I already browsed through it. Very nice, indeed.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hi again mav,
I actually tried the PNPDeviceID for my LG UP3D USB Device and it simply informed nothing. *But* going to msinfo32.exe gives me the following output:
LG UP3D USB Device USBSTOR\DISK&VEN_LG_UP3D&PROD_&REV_\200508010001&0
USB Mass Storage Device USB\VID_043E&PID_7090\200508010001
which tells me that windows actually has a PNPDeviceId for it, that being VID_043E&PID_7090 (according to the article at Coding4Fun about the wireless usb PC Lock).
Now the question is: Why?
you can check out a printscreen I've done of the simple app for identifying the hardware HERE
Cheers,
Vini
|
|
|
|
|
The wonders of windows...
I'm afraid I don't have the faintest idea why
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
hi there,
I have the following MATLAB function:
function y=drwmesh(FNo,V1,V2,T)
figure(FNo)
x=[-10:2.5:60]; y=[-20:2.5:35];
[sx sy]=MESHGRID(-10:60,-20:35);
h=STREAMLINE(V1',V2',sx,sy);
set(h,'color','red'); view(2);
xlabel('Longitude'); ylabel('Latitude');
title(T);
y=0;
I have converted it to (.dll) file by using MATLAB Builder for COM.
My problem is that I don't know how to pass the parameters: FNo(Figure No.) which is integer and the two matrices V1,V2 and the string T.
Woudl u plz write me the C# code? plz help me!!
Note: I'm using "Extreme Optimization Mathematics Library for .NET" to creat and perform matrix operatins.
Thanks in advance,
Jr.Allam
|
|
|
|
|
Hi,
If i send a comman to a device which is attached to my serial port.
How can i save the response i get?
Thanks in advance!
|
|
|
|
|
Yustme wrote: How can i save the response i get?
Create a file and write the data to the file
led mike
|
|
|
|