Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# - sending mails Pin
Luc Pattyn15-Jun-09 22:44
sitebuilderLuc Pattyn15-Jun-09 22:44 
AnswerRe: C# - sending mails Pin
Nil_IQ16-Jun-09 0:04
Nil_IQ16-Jun-09 0:04 
GeneralRe: C# - sending mails Pin
treuveni16-Jun-09 1:59
treuveni16-Jun-09 1:59 
QuestionRead Text Pin
arkiboys15-Jun-09 21:35
arkiboys15-Jun-09 21:35 
AnswerRe: Read Text Pin
himanshu256115-Jun-09 21:41
himanshu256115-Jun-09 21:41 
AnswerRe: Read Text Pin
Christian Graus15-Jun-09 22:16
protectorChristian Graus15-Jun-09 22:16 
GeneralRe: Read Text Pin
arkiboys16-Jun-09 0:35
arkiboys16-Jun-09 0:35 
QuestionProblem with data GridView C# Pin
PrakashPaul15-Jun-09 21:13
PrakashPaul15-Jun-09 21:13 
Hi,
First time I am using datagridview I have some questions and problems.
Please guide me or provide solutions if possible.

I am using adapter to bind the DGV.

1. My datasource is coming through multiple tables
Exe: select a,b,c,d from t1 left outer join t2 on t1.a=t2.d
Because of that any kind of modification update, delete, insert not working
2. unable to add auto row columns
3. unable to find cells textbox property, I want to use cells textbox autocomplete property for providing help to users
<pre> private void dgCountryZone_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (dgCountryZone.Columns[this.dgCountryZone.CurrentCell.ColumnIndex].Name.Equals("Destination Code"))
{
TextBox txt = e.Control as TextBox;
txt.Multiline = false;
txt.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
txt.AutoCompleteSource = AutoCompleteSource.CustomSource;
txt.AutoCompleteCustomSource = colCountryListCodeCheck;
}
}

4. in the time of validation if I am using cells current position its not work
exe: say present cell position is cell(4,5) now user press tab if validate pass then I want to set focus on cell(4,9) or else in cell(4,5) but it moves on cell(4,10) or cell(4,6)

<pre>private void dgCountryZone_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
Int32 RowCounter;
Int32 DuplicateCounter;
IDataReader idrCountryName;
DuplicateCounter = 0;

if (dgCountryZone.Columns[e.ColumnIndex].Name == "Destination Code")
{
if (Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) != "")
{
for (RowCounter = 0; RowCounter <= dgCountryZone.Rows.Count - 1; RowCounter++)
{
if (Convert.ToString(dgCountryZone.Rows[RowCounter].Cells[e.ColumnIndex].Value) == Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value))
{
DuplicateCounter++;
}
}
if (DuplicateCounter > 1)
{
dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "";
MessageBox.Show(MessageResource.DuplicateRecord, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
dgCountryZone.CurrentCell = dgCountryZone[e.ColumnIndex, e.RowIndex];
return;
}
else
{
DataAccessLayer daobj = new DataAccessLayer();
UserDataType.CountryParam CParam = new UserDataType.CountryParam();
CParam.szCountryCode = Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value);
dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value = "";
idrCountryName = daobj.GetHelpCountryName(CParam);
while (idrCountryName.Read())
dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value = idrCountryName.GetString(0);
if (Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value) != "")
{
dgCountryZone.CurrentCell = dgCountryZone[e.ColumnIndex + 1, e.RowIndex];
return;
}
else
{
MessageBox.Show(MessageResource.CodeNotFound, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
dgCountryZone.CurrentCell = dgCountryZone[e.ColumnIndex, e.RowIndex];
return;
}
}
}
else
{
MessageBox.Show(MessageResource.BlankField, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
dgCountryZone.CurrentCell = dgCountryZone[e.ColumnIndex, e.RowIndex];
return;
}
}
if (dgCountryZone.Columns[e.ColumnIndex].Name == "Per CWB/KG")
{
if (Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) != "")
{
if (Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value).ToUpper() != "K" && Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value).ToUpper() != "W")
{
MessageBox.Show("Please select [W for per CWB] and [K for KG]", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
dgCountryZone.CurrentCell = dgCountryZone[e.ColumnIndex, e.RowIndex];
return;
}
}
else
{
MessageBox.Show(MessageResource.BlankField, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
dgCountryZone.CurrentCell = dgCountryZone[e.ColumnIndex, e.RowIndex];
return;
}
}
}

Please suggest if I am wrong or any code help if possible

Regards
Prakash

Prakash

QuestionAdd Event to a CustomControl Pin
Sreedhar Kadiyala15-Jun-09 21:02
Sreedhar Kadiyala15-Jun-09 21:02 
AnswerRe: Add Event to a CustomControl Pin
DaveyM6915-Jun-09 22:16
professionalDaveyM6915-Jun-09 22:16 
GeneralRe: Add Event to a CustomControl Pin
Sreedhar Kadiyala15-Jun-09 23:04
Sreedhar Kadiyala15-Jun-09 23:04 
QuestionQR barcode decoder..... Pin
S K Y15-Jun-09 20:04
S K Y15-Jun-09 20:04 
AnswerRe: QR barcode decoder..... Pin
DidiKunz15-Jun-09 22:06
DidiKunz15-Jun-09 22:06 
QuestionDatetime problem Pin
Pankaj Saha15-Jun-09 20:01
Pankaj Saha15-Jun-09 20:01 
AnswerRe: Datetime problem Pin
SeMartens15-Jun-09 21:01
SeMartens15-Jun-09 21:01 
AnswerRe: Datetime problem Pin
Vikram A Punathambekar15-Jun-09 21:36
Vikram A Punathambekar15-Jun-09 21:36 
Questionwhat does a Object value return? Pin
svt gdwl15-Jun-09 19:32
svt gdwl15-Jun-09 19:32 
AnswerRe: what does a Object value return? Pin
SeMartens15-Jun-09 21:46
SeMartens15-Jun-09 21:46 
QuestionNode.Tag Pin
LTMKH15-Jun-09 19:24
LTMKH15-Jun-09 19:24 
AnswerRe: Node.Tag Pin
DaveyM6915-Jun-09 21:01
professionalDaveyM6915-Jun-09 21:01 
GeneralRe: Node.Tag Pin
LTMKH16-Jun-09 0:26
LTMKH16-Jun-09 0:26 
Questionsystem.io.filenotfoundexception from using WaveFormat structure Pin
tjeffries15-Jun-09 15:49
tjeffries15-Jun-09 15:49 
AnswerRe: system.io.filenotfoundexception from using WaveFormat structure Pin
Dave Kreskowiak15-Jun-09 16:31
mveDave Kreskowiak15-Jun-09 16:31 
GeneralRe: system.io.filenotfoundexception from using WaveFormat structure Pin
tjeffries15-Jun-09 16:52
tjeffries15-Jun-09 16:52 
GeneralRe: system.io.filenotfoundexception from using WaveFormat structure Pin
tjeffries15-Jun-09 18:39
tjeffries15-Jun-09 18:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.