C# School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a C# Expert!

Join 300,389 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,565 people online right now. Registration is fast and FREE... Join Now!




Code for a dictionary that translates English-Arabic C#

 

Code for a dictionary that translates English-Arabic C#, Writing a code for a dictionary that translates English-Arabic using d

EndlessDark

30 Jun, 2009 - 06:53 AM
Post #1

New D.I.C Head
*

Joined: 30 Jun, 2009
Posts: 1

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

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 09:39PM

Live C# Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month