hi guys i have one problem,I want to make an application for windows that encodes a text into morse....
i use an EditBox to enter the the word,and then a Button to send a each letter to a StringGrid Cell.
After that,through a loop I check the letter in every cell independently
and turn it into a morse character (example where "a" put ".---")
and the send it to a stringgrid_morse

When i compile it, it doesn't give me any error.
But when i run it,I get an error,and Dstring.h pops up
in a line saying "ThrowIfOutOfRange(idx); // Should Range-checking be optional to avoid overhead ??"

I need help I have been working on it 2 weeks (yeah I'm a noob xD)




Unit1.cpp
Code:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Encode_ButtonClick(TObject *Sender)
{



   for(int i=0;i<=Edit_Text->Text.Length();i++)
        {
           StringGrid_Text->ColCount=Edit_Text->Text.Length();
           StringGrid_Text->Cells[i][0]=Edit_Text->Text[i];

           if(StringGrid_Text->Cells[i][0]=="a"|StringGrid_Text->Cells[i][0]=="A")
            {
              StringGrid_Morse->Cells[i][0]=".-";

             }
           else if (StringGrid_Text->Cells[i][0]=="b"|StringGrid_Text->Cells[i][0]=="B")

                 StringGrid_Morse->Cells[i][0]=".--";



        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::StringGrid_MorseClick(TObject *Sender)
{

}
//---------------------------------------------------------------------------