|
How can i access parallel or serial ports in C#.
if anyone knows please tell me as early as possible.
arsaldear
|
|
|
|
|
|
Hi,
I am having various controls say... Estimated Start Date, Estimated End Date(both are text fields with date)
How can I perform these validations using Asp.net Validation Controls
1) If I input Estimated End Date, it is compulsory for me to input Estimated Start Date, other wise it can be left empty.
2) Estimated Start Date >= Todays date (if i input it)
Please Help me..
Thanks
|
|
|
|
|
i have two forms...in first form, i have menuitem, on whose click i shld display second form. Also i have two menuitems, when i click either of them i should see the same form, but the label should be different ..like if i click on menuitem1 , the label must have value "from" and if menuitem2 is clicked, then the label should have value "to"...
i want to create property for label...so can you tell how to do it...and where to create?
also how to write this property...ne help will be appreciated...
|
|
|
|
|
private System.Windows.Forms.Label lbl = new Label();
public string ChangableLabel
{
set{this.lbl.Text=value;}
}
private void menuItem[i]_Click(object sender,EventArgs e)
{
form2 f = new form();
f.ChangableLabel = "Some text";
f.Show();
}
|
|
|
|
|
yes it worked..thanks
|
|
|
|
|
thanks
|
|
|
|
|
i'm new in using c#
I need to convert what on the panel to bytes.
I ask u before
u told me to use getpixel
i really don't know how to use it in what i want
so if u can help me or tell me where can i find examples it will be so great.
thx alot
|
|
|
|
|
[C#]
// Sample for the Convert class summary.
using System;
class Sample
{
public static void Main()
{
string nl = Environment.NewLine;
string str = "{0}Return the Int64 equivalent of the following base types:{0}";
bool xBool = false;
short xShort = 1;
int xInt = 2;
long xLong = 3;
float xSingle = 4.0f;
double xDouble = 5.0;
decimal xDecimal = 6.0m;
string xString = "7";
char xChar = '8'; // '8' = hexadecimal 38 = decimal 56
byte xByte = 9;
// The following types are not CLS-compliant.
ushort xUshort = 120;
uint xUint = 121;
ulong xUlong = 122;
sbyte xSbyte = 123;
// The following type cannot be converted to an Int64.
// DateTime xDateTime = DateTime.Now;
Console.WriteLine(str, nl);
Console.WriteLine("Boolean: {0}", Convert.ToInt64(xBool));
Console.WriteLine("Int16: {0}", Convert.ToInt64(xShort));
Console.WriteLine("Int32: {0}", Convert.ToInt64(xInt));
Console.WriteLine("Int64: {0}", Convert.ToInt64(xLong));
Console.WriteLine("Single: {0}", Convert.ToInt64(xSingle));
Console.WriteLine("Double: {0}", Convert.ToInt64(xDouble));
Console.WriteLine("Decimal: {0}", Convert.ToInt64(xDecimal));
Console.WriteLine("String: {0}", Convert.ToInt64(xString));
Console.WriteLine("Char: {0}", Convert.ToInt64(xChar));
Console.WriteLine("Byte: {0}", Convert.ToInt64(xByte));
Console.WriteLine("DateTime: There is no example of this conversion because");
Console.WriteLine(" a DateTime cannot be converted to an Int64.");
//
Console.WriteLine("{0}The following types are not CLS-compliant.{0}", nl);
Console.WriteLine("UInt16: {0}", Convert.ToInt64(xUshort));
Console.WriteLine("UInt32: {0}", Convert.ToInt64(xUint));
Console.WriteLine("UInt64: {0}", Convert.ToInt64(xUlong));
Console.WriteLine("SByte: {0}", Convert.ToInt64(xSbyte));
}
}
/*
This example produces the following results:
Return the Int64 equivalent of the following base types:
Boolean: 0
Int16: 1
Int32: 2
Int64: 3
Single: 4
Double: 5
Decimal: 6
String: 7
Char: 56
Byte: 9
DateTime: There is no example of this conversion because
a DateTime cannot be converted to an Int64.
The following types are not CLS-compliant.
UInt16: 120
UInt32: 121
UInt64: 122
SByte: 123
*/
Nikhil mandalia
Software engineer.
|
|
|
|
|
sorry 4 misunderstanding.
I need to convert the picture on the panel to bytes.
I did that but it works only for the backgroungimage of a panel.
in my program I use 3ds max to draw on the panel
I need to convert the picture on the panel to bytes
thx 4 replying
|
|
|
|
|
this is the function I use to get the bytes of the backgroungimage of the panel
private void fun()
{
pna1.BackgroundImage.Save("m"); //m is the name of the file
bm = new Bitmap("m");
//the size of the panel is 240*160
byte [,] matrix= new byte [240,160];
byte red=0, green=0, blue=0;
byte [] test=new byte [1];
for (int y=0; y < 160; y++)
{
for (int x =0; x < 240; x++)
{
Color u=bm.GetPixel (x ,y);
//I need only one byte represent each pixel
blue = (byte)(u.B/64*64);
green = (byte)(u.G/32*8);
red =(byte)(u.R/32);
matrix[x,y]=(byte)(red + green + blue);
}
}
}
|
|
|
|
|
hello
some one help me plz
|
|
|
|
|
hi!
here is my problem:
as background i'm drawing a ball
gr.DrawImage(Image.FromFile("ball.bmp"),0,0,355,355);
my form is completely transparent and has no borders so i just see my round ball when i start the project.
after i pressed on a button i want to fade in a new picture over a certain part of my ball
i think the easiest way would be a picture box and a timer. every tick i lower the opacity of the new picture. but i don't think there is such an attribute.
another way could be a mixture of solidbrush, where i can set the alpha value and the texturebrush, where i can set an image.
thanks for any help
greetings, kopi_b
|
|
|
|
|
|
hy,
I have to Programm a Wizard. Now i get some problems. I have a MAIN Form and about 21-22 ChildForms. the Main Forms containsa Treeview on the left side, which must be shown everytime, thats why i put it in the ParentForm. All my ChildForms contains "Back" and "Forward" buttons. How can I make the best Practice?? I need to go forward and backward in the wizard. Without loosing the Data stored in every Child Form. How can I call the Form2 from the Form1?? And how can I go backward, without a new Instance of Form2, even i will lost the Data in the textboxes and comboboxes. A I need a powerfull Pattern for that enable me to set to Visible=True and Visible=False, while clicking on the buttons.
I try to add all the Child Forms in MdiChildren Array, but than i cannot realize how to managed them.
BUT I NEED TO COMUNICATE FROM EVERY FORM TO ANOTHER. HOWCAN I DO THAT??
Who can help me??
Giuseppe
|
|
|
|
|
Pass an instance of the previous form to the next form. If you hit "back" on the wizard, you'll have the data of the previous form already in memory, use that. For instance
void OnForm1NextButton()
{
Form2 f2 = new Form2("Yahweh", "Yirah");
f2.Show();
this.Dispose();
}
Now Form2 will know that the user name and password filled out on Form1 is Yahweh and Yirah, respectively. If you hit the back button, create a new instance of Form1 and set the user name password combo to those values.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuals for Christ, Yeah!
Judah Himango
|
|
|
|
|
Hi all:
How do I programatically maximize a windows form to cover both the display monitors?
Such that, whenever the MAXIMIZE button is clicked the form will cover the entire dual screen desktop? Pls help me.
Kind Regards.
BTW, I am coding in C# VS.net.
|
|
|
|
|
You can not do that unless you first check that both displays are of the same size, and that they are positioned exactly beside or above one another. In any other case the visible desktop will not be square, so you can not make a window cover the entire desktop without part of the window being outside the desktop.
---
b { font-weight: normal; }
|
|
|
|
|
Dear All
I have a project that grade a multiple questions exams.
Two files are the input of the system:
1-File which contains a line for each student that contains its information (such as test version and center number and ID ...etc) and answers.
2-File which contains the Key answers for each version and has the same settings of the first file.
The user of the system then will configure the settings of the file(I mean will configure the start and end of each field such as the ID field will start at index 1 to index 9).
After configuring the settings the system should load the answers and information into the database and then grade the exam.
My question is What is the best database desighn for doing that?
Is it a good practice to create an attripute for each answer(might be 210 answers) or put them all in one attripute?
And what is the best algorithm for the grading process?
please, help me...
|
|
|
|
|
Primary table is student table.
This has an index into a StudentTests table (1:* relationship)
The tests table contains an index to Test table which contains the students' test answers.
The information in StudentTests also points to a Teacher table and eventually to the Teachers' Answer for that test. (assuming that each teacher or center would have different answers to their tests)
Then for a specific test, iterate through the Test table for the specific test in the specific center for the specific teacher (returning a *:1) and just iterate through the answers. The Test table would hold an indicator for each correct/wrong answer and score. The grading algorithm would be dependant upon the rules:
is this a bell curve? is this a straight step curve?
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
Hi all,
Let me introduce you to the problem which I'm trying to cope with. I'm having two windows forms in 2 threads - one is a splash screen and the other one is the main window. On starting, the splash is visible and the main is hidden. I've written everything to the point where I've to implement signalling the splash that main is ready and closing the splash. What I've tried yesterday is to implement this with timers, so splash has a 100ms timer which checks a property on the mainwindow class and if it's true, then the splash closes itself. But then, how would I synchronise the closing of the splash with setting the main form visibility to true so they happen syncroniously(one after the other). What I've been thinking about is using events, but I'm not sure how to do this in cross-threads windows forms, ie how to design it. Should I have event for the main which is emitted when it's ready and the splash listens for this event? And then it closes itself and emits another signal that's has closed and the main listens for the closing signal of the splash? If so, how would I attach to listening to the signals across the threads? In my Main() function, I create both threads and I've two properties of the EntryPoint class(which contains the main and nothing else) - the splash form and the main form. And I have two methods which are used for the entry point of the the both, which are basically doing:
<br />
Application.Run(this.splashform);<br />
Any advice is greatly appreciated. Thanks for reading.
|
|
|
|
|
Why use 2 threads? You're introducing complexity unnecessarily.
In the constructor for your main window, I assume you have the InitializeComponent() call that actually initializes your main window. Change that constructor to
public MainWindow()
{
SplashWindow splash = new SplashWindow();
splash.Show();
InitializeComponent();
}
And when your MainWindow finishes loading (override the OnLoad method or create an OnLoad event handler), you can set the visibility of both forms synchronously.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Conversation With a Muslim
Judah Himango
|
|
|
|
|
Wouldn't the splash be blocked by the main form and not receive events? Because that's what I think will happen and most solutions for a splash use threads. Or I could be wrong...
|
|
|
|
|
1nsp1r3d wrote:
Wouldn't the splash be blocked by the main form and not receive events?
No, the splash will be free to receive events. Using multiple threads to touch different UI components is a widely-known no-no anyways. If you update your splash screen, you may need to call .Update() to force a redraw, however, since the OS is busy loading your main form.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuals for Christ, Yeah!
Judah Himango
|
|
|
|
|
|