Mitja Bonca 557 Nearly a Posting Maven

I didnt actually get you completely.
Would you like to rise an event when you choose some date?

Please clarify it a bit better.
thx

Mitja Bonca 557 Nearly a Posting Maven

hmm, what abou this:

private void button1_Click(object sender, EventArgs e)
        {
            List<int> rowIndexes = new List<int>();
            foreach (int index in listBox1.SelectedIndices)
            {
                DataRowView view = listBox1.Items[index] as DataRowView;
                int id = Convert.ToInt32(view["ID"]);
                string name = view["Name"].ToString();
                listBox2.Items.Add(name);
                //add row index to list:
                rowIndexes.Add(index);
            }
            for (int i = rowIndexes.Count; i > 0; i--)
                table.Rows.RemoveAt(rowIndexes[i - 1]);
            table.AcceptChanges();
        }
Mitja Bonca 557 Nearly a Posting Maven

Ups, really sorry, I did a stupid mistake. You were right, it really did remove only one (1st) item.

Check this out now (now I really had to dig into my brains to make it work) :)

List<int> rowIndexes = new List<int>();
            foreach (int index in listBox1.SelectedIndices)
            {
                DataRowView view = listBox1.SelectedItem as DataRowView;
                int id = Convert.ToInt32(view["ID"]);
                string name = view["Name"].ToString();
                //add the id or name to lsitBox2 (or both as DataRow)!
                rowIndexes.Add(index);
            }
            for (int i = rowIndexes.Count; i > 0; i--)
                table.Rows.RemoveAt(rowIndexes[i - 1]);
            table.AcceptChanges();
Mitja Bonca 557 Nearly a Posting Maven

How many items to you select? More then one?

Mitja Bonca 557 Nearly a Posting Maven

Yes, this looks fine, and it has to work.

And if you dont need the value (this is ID column) you can erase this code from the event.

Mitja Bonca 557 Nearly a Posting Maven

Iam glad it did.
So you can close this thread by marking it as answered.

bye,ybe

Mitja Bonca 557 Nearly a Posting Maven

Did you put all THESE code into button_Click event:

List<DataRow> rowsToRemove = new List<DataRow>(); //add this !!

            for (int i = 0; i < listBox1.SelectedItems.Count; i++)
            {
                DataRowView view = listBox1.SelectedItem as DataRowView;
                int id = Convert.ToInt32(view["course_id"]);
                string name = view["Course_name"].ToString();
                //add the id or name to lsitBox2 (or both as DataRow)!
                listBox1.Items.Add(name); //adding name only!
                //then...
                //add row to list:
                rowsToRemove.Add(view.Row);
            }
 
            //now remove selected rows:                  add this too!!
            foreach (DataRow row in rowsToRemove)
                table.Rows[0].Delete();

Copy paste it as it IS.

Because it works 100%. I tested it.

Mitja Bonca 557 Nearly a Posting Maven

eh, thats only if you want to use the option of choosing more item as a time. By default, you can select only one item.
---------

Dont look about my dummy code. Leave it alone, its there only to run my test code.
But its the same thing; I filled dataTable.
---------

To remove selected items from listBox1 use my code from button1_Click event.

Mitja Bonca 557 Nearly a Posting Maven

It will?
;)

Mitja Bonca 557 Nearly a Posting Maven

Here, I did the whole you you need:

DataTable table;
        public Form1()
        {
            InitializeComponent();
            table = new DataTable("myTable");
            table.Columns.Add("ID", typeof(int));
            table.Columns.Add("Name", typeof(string));
            //adding some example data:
            for (int i = 0; i < 6; i++)
                table.Rows.Add(i, "name " + i);
            listBox1.DataSource = table.DefaultView;
            listBox1.DisplayMember = "Name";
            listBox1.ValueMember = "ID";
            listBox1.SelectionMode = SelectionMode.MultiSimple;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            List<DataRow> rowsToRemove = new List<DataRow>();
            for (int i = 0; i < listBox1.SelectedItems.Count; i++)
            {
                DataRowView view = listBox1.SelectedItem as DataRowView;
                int id = Convert.ToInt32(view["ID"]);
                string name = view["Name"].ToString();
                //add the id or name to lsitBox2 (or both as DataRow)!

                //then...
                //add row to list:
                rowsToRemove.Add(view.Row);
            }

            //now remove selected rows:
            foreach (DataRow row in rowsToRemove)
                table.Rows[0].Delete();
        }

I almost forgot how to delete rows from listBox - when these are databound!!!
So vote some ++; :)
bye

Mitja Bonca 557 Nearly a Posting Maven

Sure, you cannot midify the number of item in a collection.
What can we do?
hmmm, let me see...

I think I know...

Mitja Bonca 557 Nearly a Posting Maven

Do it this way:

private void button1_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.MinValue;
            if (!DateTime.TryParse(textBox1.Text, out date))
            {
                string[] strSplit = textBox1.Text.Split('/');
                if (strSplit.Length == 1)
                    date = new DateTime(int.Parse(strSplit[0]), 1, 1);
                else if (strSplit.Length == 2)
                    date = new DateTime(int.Parse(strSplit[0]), int.Parse(strSplit[1]), 1);
            }
            MessageBox.Show("Real date time is " + date);
        }

Now you use "date" variable where ever you need to, or to set dateTimePicker control (to set date), or what ever.

Hope it helps,
bye

ddanbe commented: Great! +14
Mitja Bonca 557 Nearly a Posting Maven

Did you bind the listBox1, using DataSource property from DataTable?
If so, you have to 1st get the item and value from listBox item and add it some other place (in your case to listBox2):

for(int i = 0; i < listBox1.SelectedItems.Count; i++)
{
     DataRowView view = listBox1.SelectedItem as DataRowView;
     string item = view["ColumnNameOfItem"].ToString(); //can be some name
     int value = Convert.ToInt32(view["ColumnNameOfValue"]);  //can be some id (number)
     listBox2.Items.Add(item); // it you want to add item (you can add value as well);
}

ColumnNameOfItem (or OfValue) are the names of fields in your dataTable (and same are in dataBase as well). Insteads of names you can use indexes (0 and 1, but without quotation marks).

Hope it helps.
bye

Mitja Bonca 557 Nearly a Posting Maven

pop operation? What is that?

Mitja Bonca 557 Nearly a Posting Maven

int array cannot be empty. Empty is for string. Int can have only numbers. So when you initialize a new integer array all indexes set to zero This is 0 and not empty.

Mitja Bonca 557 Nearly a Posting Maven

This only depends of the structure of your code - where to catch exceptions. But ordinary we catch then on the place where they might occure.

Mitja Bonca 557 Nearly a Posting Maven

If you only want to add a Exception then do it like:

public int Sum(int a, int b)
        {
            if ((a < 0) || (b < 0))
            {
                throw new ArgumentException("Number cannot be negative");
            }
            else
            {
                return a + b;
            }
        }
Mitja Bonca 557 Nearly a Posting Maven

You can always use try-catch blocks to catch the exception. But in this cases of yours it seems not to need one.
If your method has a return type, you have to return this type in any place in the Sum method. Otherwise the compiler will throw an error.
You can do it:

private void YourMethod()
        {
            int a = -2;
            int b = 3;
            int c = Sum(a, b);
            if (c > 0)
            {
                //Ok!!
            }
            else
            {
                //show a message if needed
                //that some of values are negative
            }
        }

        public int Sum(int a, int b)
        {
            if (a < 0 || b < 0)
            {
                return 0;
            }
            else
            {
                return a + b;
            }
        }
Mitja Bonca 557 Nearly a Posting Maven

If you have to call a method on some othe class, you always have to use a reference of that class to get access to the public method (private are not visible at all).

Mitja Bonca 557 Nearly a Posting Maven

You can pass it into constructor of the class and use it:

class Main
{
     Piece[,] board = new Piece[9, 8];
     private void GoToMath()
     {
          //code...
          MathFunction mf = new MathFunction(board); //pass data to other class
          board = mf.DoSomeWork();   //do some work there, and return data
     }   
}

class MathFunction
{
     Piece[,] board;
     class MathFunction(Piece[,] _board)
     {
           this.board = _board,
     }

     public Piece[,] DoSomeWork()
     {
          //do work...
          return this.board;
     }
}
Mitja Bonca 557 Nearly a Posting Maven

or:

txtDisplay.Text = txtDisplay.Text.Remove(txtDisplay.Text.Length - 1);
Mitja Bonca 557 Nearly a Posting Maven

This is a new question. Close this thread if you are satisfied with the answer, and create a new thread. We have to follow the forum`s rules.

I`ll be in touch there, bye.

Mitja Bonca 557 Nearly a Posting Maven

1st of all: Do not change your controls (textBox in this case) access modifier. Leave it as private (never change it to public, because this is the worst thing you can do). There ar plenty of other ways to access the control, but directly from inside the class (form) where the control is instantiated. Create a new public method in this form, add a parameter to it, and then call THIS form from some other class to update the control.

And you see what can brings you when changing access modifiers? As said, leave it as private.
Example:

class Login
{
     public void UpdatingTextBox1(string msg)
     {
          textBox1.Text = msg;
     }
}

class Form1:
//inside of your method which calls Login form:
Login l = new Login();
l.UpdatingTextBox1 = "some text to pass".
Mitja Bonca 557 Nearly a Posting Maven

Check this out:

Private Shared Sub Main(args As String())
	Dim [date] As DateTime = DateTime.Today
	Dim daysNames As String() = GetDaysNames([date])
			'use each day (or show it)
	For Each days As String In daysNames
	Next
End Sub

Private Shared Function GetDaysNames([date] As DateTime) As String()
	Dim daysInMonth As Integer = DateTime.DaysInMonth([date].Year, [date].Month)
	Dim daysNames As String() = New String(daysInMonth - 1) {}

	'do your code to fill the daysNames array

	'on the end:
	Return daysNames
End Function
Mitja Bonca 557 Nearly a Posting Maven

try:

PictureBox[] pbs;
void textBox1_TextChanged(object sender, EventArgs)
{
    int num =0;
    if(int.TryParse(textBox1.Text, out num))
    {
        pbs = new PictureBox[num];
        int x = 20, y = 20;
        for(int i = 0; i < pbs.Lenght; i++)
        {
            pbs[i] = new PictureBox();
            pbs[i].Name = "pictureBox" + (i + 1);
            pbs[i].Location = new Point(x, y);  //location point
            pbs[i].Size = new Size(300,200); //custom!!
            this.Controls.Add(pbs[i]);

            //setting new point for next pictureBox:
            //this code will put 2 pictureBoxes in a row 
            //if more then 2, next two will be put in a new row:
            if(i % 2 == 0)
            {
                x = 20;
                y += 220;
            }
            else
                x += 320;
        }
    }
}

This is only an example code, you can position pictureboxes by your way.
Hope it helps.

Mitja Bonca 557 Nearly a Posting Maven

If it expects four digits, then its input cannot be in the form of an int. It must be a string. The number of decimal digits has no meaning in the 'int' type - it's not natively an decimal type. (It's actually a 32-digit binary type. It's just that C# lets you specify numeric constants as decimal text for convenience - nobody wants to type a 32-digit binary number...)

You say your "my method accepts integers onli", but that contradicts what you say here: "it accepts only 4 digits in the Year field"

One of those statements must be untrue. The 'int' type in C# and also Java (presumably Java is somehow involved if you have a JAR file) doesn't have any mechanism for representing leading zeroes.

So if your method only accepts integers, then by definition it can't care about leading zeroes because the 'int' type doesn't actually support that concept. And if your method accepts only 4 digits, then by defintion the data you're passing it can't be an 'int' because if it was, it wouldn't be able to tell whether there was a leading digit or not.

As far as the 'int' type is concerned, 999, 0999, 0000999, 0x3E7, and 0x00003E7 are all exactly the same thing. These different textual representations are completely indistingiushable in an 'int' because they all have the same binary representation: 0000001111100111.

Note that the leading zeroes are always present in the underlying representation. 'int' is 32-bits. If …

Mitja Bonca 557 Nearly a Posting Maven

You can create a seperate custom class which will hold the data. In any of the form you must have a reference (which has to be instantiated only one - on beginning) to this class; so you can access to the data on the class. The data can be in some properties, or in some collections line generic list.


Example:

class DataClass
{
    public List<string> list;
    pubic DataClass
    {
        list = new List<string>();
    }
}

class Form1 //create and set data
{
    Form2 f2;
    void Method1() //can be a button_Click event
    {
        //open form2 and pass data
        DataClass dc = new DataClass();
        dc.list.Add("Some text 1");
        dc.list.Add("Some text 2");
        if(f2 == null)
             f2 = new Form2(dc);  //passing reference of dataClass to other form
    }
}

class Form2 //set data
{
    Form3 f3;
    DataClass dc;
    public Form3(DataClass _dc)
    {
         this.dc = _dc;
    }

    void Method2() //can be a button_Click event
    {
        //open form3 and pass data        
        dc.list.Add("Some text 3");
        dc.list.Add("Some text 4");
        if(f3 == null)
             f3 = new Form3(dc);  //passing reference of dataClass to other form
    }
}

class Form3 // get data
{
     DataClass dc;
     public Form3(DataClass _dc)
     {
          this.dc = _dc;
     }
     
     void Method3()
     {
         // get the data from data class
         
         foreach(string str in dc.list)
         {
              //each str value has a value from the list
              string text = str;                  
         }
     }
}

This is only one of examples how to add data on forms, and get the data back out.

Mitja Bonca 557 Nearly a Posting Maven

Sure you can do, but you cannot addd comboBox control to TextBox array. But you can add its text additionally, like:

Textbox[]tbs = { textBox1, textBox2, textBox3 }; // add all of them in here
StringBuilder sb = new StringBuilder();
foreach(TextBox tb in tbs)
     sb.AppendLine(tb.Text);
//adding text from comboBox too:
sb.AppendLine(comboBox1.SelectedItem.ToString());

System.IO.File.WriteAllText(@"C:\myFile.txt", sb.ToString());
Mitja Bonca 557 Nearly a Posting Maven

Get all the textBoxes into an array, and read them (using Text property) into a StringBuilder class. Then write all to a text file:

Textbox[]tbs = { textBox1, textBox2, textBox3 }; // add all of them in here
StringBuilder sb = new StringBuilder();
foreach(TextBox tb in tbs)
     sb.AppendLine(tb.Text);

System.IO.File.WriteAllText(@"C:\myFile.txt", sb.ToString());
Mitja Bonca 557 Nearly a Posting Maven

Why you dont get the image directly out of the cell? You dont need to parse it to object.

Example:

public Form1()
        {
            InitializeComponent();
            //creating image column:
            DataGridViewImageColumn imageColumn = new DataGridViewImageColumn();
            {
                imageColumn.Name = "colImages";
                imageColumn.HeaderText = "Images";
                imageColumn.Width = 100;
                imageColumn.ImageLayout = DataGridViewImageCellLayout.Normal;
                imageColumn.CellTemplate = new DataGridViewImageCell(false);
                imageColumn.DefaultCellStyle.NullValue = null;
            }
            //adding column to dgv:
            dataGridView1.Columns.Add(imageColumn);

            //adding one image to cell of dgv:
            dataGridView1.Rows.Add();
            Image pic= Image.FromFile(@"C:\1\backward.png");
            dataGridView1[0, 0].Value = pic;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //retreiving image form dgv:
            Image img = (Image)dataGridView1[0, 0].Value;
        }
Mitja Bonca 557 Nearly a Posting Maven

But dont forget to subscribe to TextChanged event in Form_Load event (like I showed you for other KeyPress event).

Mitja Bonca 557 Nearly a Posting Maven

hmm, sorry, your project is a .net applicaiton, not a windows app.
So you need an event for web app. There is no KeyPress event. There ar only these events.

You could use TextChecked event.
Just did this code for you, and it works fine.

bool bJump;
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (!bJump)
            {
                if (textBox1.Text.Length > 0)
                {
                    char lastChar = textBox1.Text.Substring(textBox1.Text.Length - 1)[0];
                    if (!char.IsLetter(lastChar))
                    {
                        bJump = true;
                        textBox1.Text = textBox1.Text.Remove(textBox1.Text.Length - 1, 1);
                        textBox1.SelectionStart = textBox1.Text.Length;
                        textBox1.SelectionLength = 0;
                    }
                }
            }
            else
                bJump = false;
        }
Mitja Bonca 557 Nearly a Posting Maven

You didnt just copy/paste my code?
For the event you have to SUBSCRIVE, not only copy it.
YOu can do:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Windows.Forms;

public partial class Parts_PMEWDirectorate : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
       this.txt_DirName.KeyPress += new KeyPressEventHandler(txt_DirName_KeyPress); //ADD THIS LINE OF CODE - this is subscribing!!
    }


    protected void btn_save_Click(object sender, EventArgs e)
    {
        btn_save.Enabled = false;

        lookups insert = new lookups();
        string result = insert.PMEWDirectorates_Insert(txt_DirName.Text.Trim(), txt_DirHead.Text.Trim());
        if (result == "0")
        {
            lbl_msg.ForeColor = System.Drawing.Color.Blue;
            lbl_msg.Text = "Successful";
        }
        else
        {
            lbl_msg.ForeColor = System.Drawing.Color.Red;
            lbl_msg.Text = result;
        }
        btn_save.Enabled = true;
    }



    private void txt_DirName_KeyPress(object sender, KeyPressEventArgs e)
    {
         if (e.KeyChar != '\b')
            {               
             //allows just letter keys    
             e.Handled = !char.IsLetter(e.KeyChar); 
         }
    }   
}
Mitja Bonca 557 Nearly a Posting Maven

I thought so...
So you have to do thia a bit differently to get the rows where the checkBox is added:

For Each row As DataGridViewRow In dataGridView1.Rows
	Dim chk As DataGridViewCheckBoxCell = TryCast(row.Cells(0), DataGridViewCheckBoxCell)
			'this row has a checked checkBox
			'do your code in here...
	If Convert.ToBoolean(chk.Value) = True Then
	End If
Next
Mitja Bonca 557 Nearly a Posting Maven

In which part of my code shall i add it?

??

Subscribe to the textBox_KeyPress event, this will rise every time user will type into textBox. While typing it will not allow to enter other chars then letters (letters only, so no special chars, or numbers).

Mitja Bonca 557 Nearly a Posting Maven

Why do you have this code then:

IsRowSelected = Me.dgv1.Rows(i).Cells(1).Value

This means you have in each row of 2nd column a boolean type of value.

If not, what value do you check there in 2nd column?

Mitja Bonca 557 Nearly a Posting Maven

Is your 2nd column type of bool? Does it hav true of false values?

Mitja Bonca 557 Nearly a Posting Maven

You mean that all the letters from string1 are in string2?
Is so, hericles solution will work, but partly, you need a break point of the for loop, when all indexes are reached.

hericles`s code needs to be modified a bit (and in VB):

Dim s1 As String = "an apple"
Dim s2 As String = "each apple is not an issue"

Dim s1Array As String() = s1.Split(" "C)
Dim bContains As Boolean = False
For i As Integer = 0 To s1Array.Length - 1
	If s2.Contains(s1Array(i)) Then
		bContains = True
	Else
		Exit For
	End If
Next
If bContains Then
	Console.WriteLine("All words that are in s1 are in s2 as well.")
Else
	Console.WriteLine("s2 does NOT contain all words from s1.")
End If
Mitja Bonca 557 Nearly a Posting Maven

To allow letters only subscribe to KeyPress event of textbox, and put this code inside (dont copy/paste the event, just the code inside of it):

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            //allows backspace key
            if (e.KeyChar != '\b')
            {
                //allows just letter keys
                e.Handled = !char.IsLetter(e.KeyChar);  
            }
        }
Mitja Bonca 557 Nearly a Posting Maven

Try it this way:

using system;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Printing; 

private void Button1_Click(object sender , eventargs e)
{
    PrintDocument pd = new PrintDocument();
    pd.PrintPage+= new PrintPage(printing);
    pd.Print();
} 

void printing(object sender , PrintPageEventArgs e)
{

   Bitmap bitmap = new Bitmap(datagrid1.width,datagrid1.height);
   datagrid1.DrawtoBitmpa(bitmap,datagrid1.ClientRectangle);
   e.Graphics.DrawImage(bitmap,new Point(50,50));
}
Mitja Bonca 557 Nearly a Posting Maven

Use a separate form that is borderless as well and has an Opacity of .5. Make it slightly bigger than the main form. You can make the "drop shadow" invisible to clicks by using a combination of WS_EX_NOACTIVATE and WS_EX_TRANSPARENT in the CreateParams() function. Simply move the drop shadow whenever the main form moves.


check this code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {

        DropShadow ds = new DropShadow();

        public Form1()
        {
            InitializeComponent();
            this.Shown += new EventHandler(Form1_Shown);
            this.Resize += new EventHandler(Form1_Resize);
            this.LocationChanged +=new EventHandler(Form1_Resize);
        }

        void Form1_Shown(object sender, EventArgs e)
        {
            Rectangle rc = this.Bounds;
            rc.Inflate(10, 10);
            ds.Bounds = rc;
            ds.Show();
            this.BringToFront();
        }

        void Form1_Resize(object sender, EventArgs e)
        {
            ds.Visible = (this.WindowState == FormWindowState.Normal);
            if (ds.Visible)
            {
                Rectangle rc = this.Bounds;
                rc.Inflate(10, 10);
                ds.Bounds = rc;
            }
            this.BringToFront();
        }

    }

    public class DropShadow : Form
    {

        public DropShadow()
        {
            this.Opacity = 0.5;
            this.BackColor = Color.Gray;
            this.ShowInTaskbar = false;
            this.FormBorderStyle = FormBorderStyle.None;
            this.StartPosition = FormStartPosition.Manual;
        }

        private const int WS_EX_TRANSPARENT = 0x20;
        private const int WS_EX_NOACTIVATE = 0x8000000;

        protected override System.Windows.Forms.CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle = cp.ExStyle | WS_EX_TRANSPARENT | WS_EX_NOACTIVATE;
                return cp;
            }
        }
    }
}
Mitja Bonca 557 Nearly a Posting Maven

You have one main dataTable with all the data. When you want to filter it, create new DataTable, create same column as main one has (by using Clone method):

Dim temp As New DataTable()
temp = mainTable.Clone()
'this was you get the table structure - same as main one

Now use Select property to filter data.
my Example:

Private table As DataTable
Private Sub MethodToFilter()
	table = New DataTable("MainTable")
	table.Columns.Add("Id", GetType(Integer))
	table.Columns.Add("Value", GetType(String))

	'adding some example rows (10):
	For i As Integer = 0 To 9
		table.Rows.Add(i, "item " & i)
	Next

	'now filter:
	'get all rows that Id is higher then 6 (so 3 rows will be added to new dataTable):
	Dim filterDT As DataTable = table.Clone()
	Dim rows As DataRow() = table.[Select]("Id > 6")
	For Each row As DataRow In rows
		filterDT.ImportRow(row)
	Next

	'now use filterDT as your new filtered dataTable...
End Sub
Mitja Bonca 557 Nearly a Posting Maven

Compare both texts to "ToLower":

if (text.Contains(arr[x, 0].ToLower()))
{
    text = text.Replace(arr[x, 0], arr[x, 1]);
}
Mitja Bonca 557 Nearly a Posting Maven

hi, check here.

Mitja Bonca 557 Nearly a Posting Maven

Sure you can - if its in any help to use 0.0 (maybe for some comparison), but better like this:

private void yourMethod()
{
    float = inputMethod(textBox1.Text);
    if(floaf == 0.0)
    {
         MessageBox.Show("Please enter a number in the account number section "); 
    }
}
public float inputMethod() 
{ 
    float temp; 
    if (!float.TryParse(txtInitialTemp.Text, out temp))    
       return 0.0F;
    else
       return temp;
}
Mitja Bonca 557 Nearly a Posting Maven

Check this out:

bool bExit = false;
            bool bReType = false;
            Console.WriteLine("Please type in a binary number: ");
            while (!bExit)
            {
                while (!bReType)
                {
                    string binarynumber = Convert.ToString(Console.ReadLine());
                    foreach (char digit in binarynumber.ToCharArray())
                    {
                        if (char.IsDigit(digit))
                        {
                            int myInt = int.Parse(digit.ToString());
                            if (myInt != 1 && myInt != 0)
                            {
                                Console.WriteLine("The binary number can only be 1 and 0, please re-type");
                                bReType = true;
                                break;
                            }
                        }
                        else
                        {
                            Console.WriteLine("The char is not a number, please re-type.");
                            bReType = true;
                            break;
                        }
                    }
                    if (!bReType)
                    {
                        bReType = true;
                        bExit = true;
                    }
                }
                bReType = false;
            }
            // when code exits the loop, you can continue working, it will
Mitja Bonca 557 Nearly a Posting Maven

Or a bit more suphisitcated, using checking if char is number (and a bit different checking of binary data):

bool bExit = false;
  Console.WriteLine("Please type in a binary number: ");
  string binarynumber = Convert.ToString(Console.ReadLine());
  while (!bExit)
  {
      foreach (char digit in binaryNumber)
      {
          if(char.IsDigit(digit)
          {
              int digit = Convert.ToInt32(new string();
              if (digit != '1' || digit != '0')
              {
                   Console.WriteLine("The binary number can only be 1 and 0, please retype");   
                   bExit = true; //char is not 0 or 1
                   break;
              }
          } 
          else 
               bExit = true; // char is not a number!
      }
      break; // all ok!
   }  
   if(!bExit)
   {
       // when code exits the loop, you can continue working, it will 
   }
Mitja Bonca 557 Nearly a Posting Maven

Hi,
read here about it.

bye

Mitja Bonca 557 Nearly a Posting Maven

Try to read a book, or more of them. Amazon.com is a great place to start with.great place to start with.
And while reading and going through example code, do your own examples in VS.

Mitja Bonca 557 Nearly a Posting Maven

Use Crystal Reports. You can create fields, and pass parameters to them (inside parameters there are your data).
Check this website, and check all the links bellow.