hello ! my thesis is all about language translation and im having a problem with the concatenation of strings in the textbox...because for example i input city kiss and it will display the ilocano(dialect) ili agek but when i input kiss city it still display ili agek

Recommended Answers

All 6 Replies

Hi ishtine18, welcome on Daniweb!
Could you post some code?
Without it it is hard to solve your problem.

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        static string str_conn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\Desktop\thesis(data).mdb";
        private OleDbConnection conn;
        private OleDbDataAdapter da;
        private DataSet ds;
        private OleDbCommand Dictionary;
        private OleDbDataReader dr;
        string[] strSplit;
        string strOne;    

        private void button1_Click(object sender, EventArgs e)
        {
            //strOne = textBox1.Text;
            if (textBox1.Text == "")
            {
                MessageBox.Show("Please Enter Text in the Textbox!");
                label5.Text = "";
            }

            if (comboBox2.SelectedItem == "Ilocano" && comboBox1.SelectedItem == "English")
            {
                strOne = textBox1.Text;
                string seperator = "";
                strSplit = textBox1.Text.Split(seperator.ToCharArray());
                string complete = "";

                foreach (string x in strSplit)
                {
                    complete = complete + "'" + x.ToString() + "',";
                }

                    Dictionary = new OleDbCommand("Select Ilokano FROM Dictionary where English IN ("+ complete + "'')", conn);
                    Dictionary.CommandType = CommandType.Text;
                    Dictionary.Connection = conn;
                    dr = Dictionary.ExecuteReader();
                    while (dr.Read())
                    {
                        label5.Text = label5.Text + " " + dr["Ilokano"].ToString();
                    }

            }
           else if (comboBox1.SelectedItem == "Ilocano" && comboBox2.SelectedItem == "English")
            {
                //strOne = textBox1.Text;
                //string seperator = "";
                //strSplit = textBox1.Text.Split(seperator.ToCharArray());
                //string complete = "";
                //foreach (string x in strSplit)
                //{
                //    complete = complete + "'" + x.ToString() + "',";
                //}

                Dictionary = new OleDbCommand("Select English FROM Dictionary where Ilokano like" + "'%" + textBox1.Text + "%'", conn);
                Dictionary.CommandType = CommandType.Text;
                Dictionary.Connection = conn;
                dr = Dictionary.ExecuteReader();
                dr.Read();
                //while (dr.Read())
                //{
                    label5.Text = dr["English"].ToString();
                //}
            }


        }

Please use code tags when you send some code.
Isn't it a problem you use both "llocano" and "llokano"?

Please use code tags when you send some code.
Isn't it a problem you use both "llocano" and "llokano"?


okay sorry..im just new here :)

Ilocano is the name in the combobox..and Ilokano is the name of a column in the database...
and as i see its like the first data in the database is the one will be displayed first..hmm

int LastSep=0;
for (int i=0; i< textBox1.Text.Length;i++)
{
  if (textBox1.Text[i] == ' ')
  {
    label5.Text += new OleDbCommand("Select English FROM Dictionary where Ilokano like" + "'%" +  textBox1.Text.SubString(LastSep,i-LastSep) + "%'", conn).ExecuteScaler().toString() + " ";
    LastSep=i;
  }
  if (i == textBox1.Text.Length-1 && textBox1.Text[textBox1.Text.Length-1] != ' ')
  {
        label5.Text += new OleDbCommand("Select English FROM Dictionary where Ilokano like" + "'%" +  textBox1.Text.SubString(LastSep,i-LastSep) + "%'", conn).ExecuteScaler().toString();
  }
}

Try this
I didn't have a compiler so there maybe syntax errors

Please let me know if you need clarification

I don't see where you opened the Connection

string s = txtValue.Text;
char[] delimeter={',','@','$',' ','#','%','*','\t'};
string[] word = s.Split(delimeter);
txtFName.Text = word[0];
txtLName.Text = word[1];
txtAge.Text = word[2];
txtDOB.Text = word[3];

commented: You joined Daniweb to post that? Did you even try to read what the OP said? -2
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.