CODE
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
OleDbConnection db;
string language;
public Form1()
{
InitializeComponent();
//syntax of connection
db = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =|DataDirectory|\\Database1.mdb");
}
private void button1_Click(object sender, EventArgs e)
{
string val = textBox1.Text;
OleDbCommand aCommand = new OleDbCommand("select English, Arabic from dict", db);
try
{
db.Open();
OleDbDataReader aReader = aCommand.ExecuteReader();
while (aReader.Read())
{
// if (language == "English")
//{
if (val == aReader.GetString(0))
{
string str = aReader.GetString(1);
textBox2.Text = str;
}
// }
//if (language == "Arabic")
//{
// if (val == aReader.GetString(1))
// {
// string str = aReader.GetString(0);
// textBox2.Text = str;
// }
//}
}
aReader.Close(); //close the reader
db.Close(); //close the connection
}
catch (OleDbException ee)
{
Console.WriteLine("Error:(0)", ee.Errors[0].Message);
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close(); //takes the current form and close it
}
}
}
This is what i wrote, it can now translate from English to Arabic, when i write a table called dict in a access file called database1.
I am supposed to add new features but i am not a very good pro in programming.
Can anyone help by giving ideas and anyway to implement them.
I'm not familiar with C #
this is my 1st program using C #
Thank you so much