TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
m e
NA
1
3.1k
c# textbox autocomplete dataset ?
Jul 2 2016 7:09 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace per
{
public partial class Form1 : Form
{
DataSet1TableAdapters.tblPerTableAdapter dap = new DataSet1TableAdapters.tblPerTableAdapter();
public Form1()
{
InitializeComponent();
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void label5_Click(object sender, EventArgs e)
{
}
private void button7_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
pictureBox1.ImageLocation = openFileDialog1.FileName;
}
private void button2_Click(object sender, EventArgs e)
{
if (dap.GetDataByCode(textBox1.Text).Rows.Count==0)
{
dap.Insert(textBox1.Text, textBox2.Text, textBox3.Text, System.IO.File.ReadAllBytes(pictureBox1.ImageLocation), comboBox1.Text, maskedTextBox1.Text, radioButton1.Checked, (int)numericUpDown1.Value, checkBox1.Checked, (int)numericUpDown2.Value, checkBox2.Checked, (int)numericUpDown3.Value, checkBox3.Checked, richTextBox1.Text, textBox4.Text);
fill();
temp();
}
else
{
MessageBox.Show("??? ??? ?????? ?? ????");
return;
}
}
void temp()
{
textBox1.Text="";
textBox2.Text="";
textBox3.Text="";
pictureBox1.ImageLocation = System.IO.Path.Combine(Application.StartupPath,"noimage.png");
comboBox1.SelectedIndex=-1;
maskedTextBox1.Clear();
numericUpDown1.Value=0;
checkBox1.Checked=false;
numericUpDown2.Value=0;
checkBox2.Checked=false;
numericUpDown3.Value=0;
checkBox3.Checked=false;
richTextBox1.Clear();
textBox4.Text="";
}
private void button5_Click(object sender, EventArgs e)
{
var d = dap.GetDataByCode(textBox1.Text);
if (d.Rows.Count==0)
{
MessageBox.Show("???? ???? ???? ?????");
return;
}
dataGridView1.DataSource = d;
textBox1.Text = d.Rows[0][0].ToString();
textBox2.Text = d.Rows[0][1].ToString();
textBox3.Text = d.Rows[0][2].ToString();
string path = System.IO.Path.Combine(Application.StartupPath + textBox1.Text + ".png");
System.IO.File.WriteAllBytes(path,(byte[])d.Rows[0]["picper"]);
pictureBox1.ImageLocation = path;
comboBox1.Text = d.Rows[0][4].ToString();
maskedTextBox1.Text = d.Rows[0][5].ToString();
radioButton1.Checked = !(radioButton1.Checked = (bool)d.Rows[0][6]);
numericUpDown1.Value = (int)d.Rows[0][7];
checkBox1.Checked=(bool)d.Rows[0][8];
numericUpDown2.Value = (int)d.Rows[0][9];
checkBox2.Checked = (bool)d.Rows[0][10];
numericUpDown2.Value = (int)d.Rows[0][11];
checkBox2.Checked = (bool)d.Rows[0][12];
richTextBox1.Text = d.Rows[0][13].ToString();
textBox4.Text = d.Rows[0][14].ToString();
button2.Enabled = false;
button3.Enabled = true;
button4.Enabled = true;
}
private void button6_Click(object sender, EventArgs e)
{
dataGridView1.DataSource = dap.GetData();
temp();
button2.Enabled = true;
button3.Enabled = false;
button4.Enabled = false;
}
private void Form1_Load(object sender, EventArgs e)
{
fill();
}
void fill()
{
dataGridView1.DataSource = dap.GetData();
pictureBox1.ImageLocation = System.IO.Path.Combine(Application.StartupPath, "noimage.png");
}
private void button3_Click(object sender, EventArgs e)
{
if (MessageBox.Show("??? ????? ??????","??? ????",MessageBoxButtons.YesNo,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2)==System.Windows.Forms.DialogResult.Yes)
{
dap.DeleteByCodetblPer(textBox1.Text);
}
button2.Enabled = true;
button3.Enabled = false;
button4.Enabled = false;
}
private void button4_Click(object sender, EventArgs e)
{
dap.UpdateByCodetblPer(textBox2.Text, textBox3.Text, System.IO.File.ReadAllBytes(pictureBox1.ImageLocation), comboBox1.Text, maskedTextBox1.Text, radioButton1.Checked, (int)numericUpDown1.Value, checkBox1.Checked, (int)numericUpDown2.Value, checkBox2.Checked, (int)numericUpDown3.Value, checkBox3.Checked, richTextBox1.Text, textBox4.Text,textBox1.Text, textBox1.Text);
button2.Enabled = true;
button3.Enabled = false;
button4.Enabled = false;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
Reply
Answers (
2
)
How to use async and await methods in mvc ?
EXE file In My Projects