3
Answers

C# integer from text file

Lars Nilsson

Lars Nilsson

14y
3.4k
1
Hey guys,

Im new here and I need your help, please.

Im working on something that uses the Paint event in Visual C# 2010, and I need to draw a rectangle. The rectangle can only be drawn by integer values in it,
and I got these integer values in a text file. So what I need to do is to read the integer from either row 2 or row 3 in the text file and assign that value to an integer in the program.
How can I do that?

I heard something about Console.ReadLine(); but it just works with strings, also I tried Console.Read(); which just read one character (i guess) without that I specified what line it should
read from. Im kind of confused.

Please help.

By the way, I use framework 2.0 as goal, so all my friends can try the program later.

- Lars.
Answers (3)
0
ali

ali

NA 14 0 14y

it is working in massage box
but when i do following changes to change button text
switch (e.Button)
                {
                    case MouseButtons.Left:
                        button1.Text = ("X");
                        break;
                    case MouseButtons.Right:
                        button1.Text = ("0");
                        break;
                    case MouseButtons.Middle:
                        break;
                    default:
                        break;
                }
 
it works it change the text but when i click on form
i want it to change when i click on button
can u help me one more time
0
Jaish Mathews

Jaish Mathews

NA 7.3k 1.2m 14y

 
Hi,
MouseEventArgs is defines  under "System.Windows.Forms".
But you are already in Form so only need to use like below
private void Form_MouseDown(object sender, MouseEventArgs e)
0
ali

ali

NA 14 0 14y

Event Handler
private void Form_MouseDown(object sender, System.Windows.MouseEventArgs e)

 
 
THIS error OCCURED
The type or namespace name'MouseEventArgs '  does not exist in the namespace 'System' (are you missing an assembly reference?)
 
WHT SHOULD I DO iT URGENT PLZ HELP
0
Jaish Mathews

Jaish Mathews

NA 7.3k 1.2m 14y

Hi,
The EventHandler declaration should be like below.
this.MouseDown +=  new System.Windows.Forms.MouseEventHandler(this.Form_MouseDown);

You are using  System.WinForms.MouseEventHandler. I never saw any thing like this
 
0
ali

ali

NA 14 0 14y

im working in window.
plz help me bro its ugrent 
0
Amit Choudhary

Amit Choudhary

NA 27.7k 3m 14y
hi friend,

 Are you doing it in Console application.?? or in Windows itself?