HiHi seems like i have so many queries for programming..

EG. textbox use to set the password
how can i make a program so that i can set MINIMUM character to be inserted in textbox is 7 then i can save the data if not validate[ insert password with at least 7 character]

something like that haas. sorry if you don't understand my question cause i don't really know to phrase my problem=|

BTNOK[ to check if textbox 7 character and then run save if it is. else validate insert 7 character~]

Just test the length.

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 daniweb
{
  public partial class frmLoginScreen : Form
  {
    public frmLoginScreen()
    {
      InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
      if (string.IsNullOrEmpty(textBox1.Text))
      {
        MessageBox.Show("You must enter a password.");
        return;
      }
      else if (textBox1.Text.Length < 7)
      {
        MessageBox.Show("Your password must be at least 7 characters.");
        return;
      }
      else
      {
        //Save password
      }
    }
  }
}
commented: it's definitely a good reference. =) +1

Just test the length.

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 daniweb
{
  public partial class frmLoginScreen : Form
  {
    public frmLoginScreen()
    {
      InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
      if (string.IsNullOrEmpty(textBox1.Text))
      {
        MessageBox.Show("You must enter a password.");
        return;
      }
      else if (textBox1.Text.Length < 7)
      {
        MessageBox.Show("Your password must be at least 7 characters.");
        return;
      }
      else
      {
        //Save password
      }
    }
  }
}

geee thanks.. this coding is easier to understand. haas. have just tried=)

TextBox has a MaxLength property. Set it to 7 if you do not want users to type more than 7 chars.

It is very usefull to us..!! and thanks for the information..!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.