Upload
ilija-arsovski
View
217
Download
3
Embed Size (px)
Citation preview
Private void button1_click(object Sender, EventArgs e){
string str=textbox1.text;int suma=0
string[]oddeli=str.split(‘\n’)if (oddeli.Lenth !=3)
label2.text=”nevistina”else{
foreach (string s in oddeli)string [] pole=s.split (‘$’)
if (pole.Length !=3){label2.text=”nevistina”;
break:|}else
foreach (string s1 in pole){int rez;
if (int.tryParse (s1,out rez)== true)suma+=rez;
label2.text =”vistina, zbirot iznesuva +suma.ToString();
UKIM I UGDprivate void button1_Click(object Sender, EventArgs e)
string str = ttextBox1.Text; int count=0;
if (str.Contains("УГД")) int pocicija = str.IndexOf("УГД");
string[] pole = str.Split(' '); foreach (string s in pole)
if (s == "УГД") count++;
label2.Text = "Позиција: " + pocicija.ToString() + "\nБрој на појавувања: " + count.ToString();
string rez = str.Replace("УГД", "УГД-ФИ"); File.WriteAllText("D:\\sodrzina.txt", rez);
else label2.Text = "Не е пронајден зборот УГД";
KALKULATORprivate void button1_Click(object Sender, EventArgs e)
if ((textBox1.Text.Length != 0) && (textBox2.Text.Length != 0)) double pr = double.Parse(textBox1.Text) *
double.Parse(textBox2.Text); label2.Text = "Резултат: "+pr.ToString();
else label2.Text = "Внесете вредности!";
BAZA private void button1_Click(object sender, EventArgs e)
SqlCeConnection conn = new SqlCeConnection ();conn.ConnectionString = "data
source=C:\\SqlCeCommand com = new SqlCeCommand ();
com.CommandText="INSERT INTO T1 (Ime, Prezime, Telefon )" +
" VALUES ('" + t1.Text + "', '" + t2.Text + "', " + " '" + t3.Text + "') ";
com.Connection = conn;conn.Open();
com.ExecuteNonQuery(); conn.Close();