Im using windows form applicaton
and try using a method that returns a value and have a parmeterlist input.

I try to creat a program that converts a number of kilobytes (KB) to byte. The program's user to specify the number of KiB and the program will print the same number of bytes.
For conversion of KB to change the program should call a separate method that you have defined. The method is via its parameter list to load KiB number, convert the number of KB to the corresponding value in bytes and return that value.

Any idea

Thanks Sir
Her is my solution but I got error,I hope you can help me.

public partial class Form1 : Form
        public Form1()

        private void btnconverter_Click(object sender, EventArgs e)
            int kib = 0 ;
             kib = Convert.ToInt32(txtKib.Text);
             txtResult.Text = Convert.ToString(calc(kib));

        private int calc(int numberOfKib);
            return  numberOfKib/1024

Edited 3 Years Ago by tony75

As I understand you well, the user inputs in a textbox a number of KB after clicking a button the program calculates the number of bytes and puts the result in another textbox. Correct?
If answer is yes, then in your calc method, you should multiply by 1024, instead of dividing.

Yes you understan me very well
But I got those error?

Error 1 Invalid token '{' in class, struct, or interface member declaration

Error 2 Invalid token '1024' in class, struct, or interface member declaration

Edited 3 Years Ago by diafol: fixed formatting

This question has already been answered. Start a new discussion instead.