CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    Mar 2009
    Posts
    7

    [FIXED]Datarepeatercontrol leave event object sender changing!

    Hello,

    my 1st post

    I am using visual basic power pack controls and Net 3.5 with the Datarepeatercontrol in c#.

    i have it working great!! except for this weird thing i cant figure it out...

    i was able to Try and catch the exception and it goes on working unnoticed (and even passes the data????) but i want to fix the exception instead of hiding it.

    I have the datarepeater control with a tableLayoutPanel then a textbox on that.

    in the textbox textbox_leave event i have the following code:


    Code:
    private void txtdata_Leave(object sender, EventArgs e)
            {
                try
                {
                    dtsource.Rows[CurrentRow][intColIndex] = ((TextBox)sender).Text;
                    ((DataTable)rptrData.DataSource).Rows[intColIndex]["ColumnData"] = ((TextBox)sender).Text;
    
                  
                }
                catch
                {
    
                    ;
                }
    so basically it updates my datatable when i leave the textbox.

    if i leave the texbox to anything on the repeater data control, it doesnt show an error

    but if i go to click something outside of the window, like a menu item or button outside of the data repeater control area i get a

    "Unable to cast object blah blah visual basic powerpack to System.textbox"


    so i click continue and it still works!! the data is still updated into the table...

    so for a quick fix i put in the try and catch and it works.

    but i want to fix it right...


    it looks like it sending 2 different objects as the sender?? hmmmm i dunno how to fix it.

    please help !!

    thanks
    Last edited by drex; March 12th, 2009 at 12:39 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured