trying to get 2 separate values in alert box
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: trying to get 2 separate values in alert box

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    12

    trying to get 2 separate values in alert box

    On my error message both inspStartTime.StartTime & inspEndTime.EndTime end up being the same values returned. Although they each belogn to a different textbox. Any clues?

    Code:
               for (int i = 0; i < VisualTreeHelper.GetChildrenCount(myVisual); i++)
                {
                    // Retrieve child visual at specified index value.
                    Visual childVisual = (Visual)VisualTreeHelper.GetChild(myVisual, i);
    
    
    
                    // Do processing of the child visual object.
                    if (childVisual is TextBox)
                    {
                        MaskedTextBox btn = (MaskedTextBox)childVisual;
                        //Check first to see if the element is null
                        if (btn.Tag != null)
                        {
    
                      
    
                            inspStartTime = new InspectionTime();
                            inspStartTime.TimeID = Convert.ToInt32(btn.Uid);
                            inspStartTime.StartTime = btn.Text;
                            
                            inspEndTime = new InspectionTime();
                            inspEndTime.TimeID = Convert.ToInt32(btn.Uid);
                            inspEndTime.EndTime = btn.Text;
                           
                         
    
                           // updateMileage = Convert.ToInt32(StartTime.Text.Trim());
                           // updateMileage = Convert.ToInt32(EndTime.Text.Trim());
    
    
                            {
             control.ShowErrorMessage("Litte Test." + inspStartTime.StartTime + " " + inspEndTime.EndTime,  MessageBoxImage.Exclamation);
                            }

  2. #2
    Join Date
    Jan 2006
    Location
    18 32' N / 73 52' E
    Posts
    416

    Thumbs up Re: trying to get 2 separate values in alert box

    Quote Originally Posted by neo_xaml View Post
    On my error message both inspStartTime.StartTime & inspEndTime.EndTime end up being the same values returned. Although they each belogn to a different textbox. Any clues?

    Code:
               for (int i = 0; i < VisualTreeHelper.GetChildrenCount(myVisual); i++)
                {
                    // Retrieve child visual at specified index value.
                    Visual childVisual = (Visual)VisualTreeHelper.GetChild(myVisual, i);
     
     
     
                    // Do processing of the child visual object.
                    if (childVisual is TextBox)
                    {
                        MaskedTextBox btn = (MaskedTextBox)childVisual;
                        //Check first to see if the element is null
                        if (btn.Tag != null)
                        {
     
     
     
                            inspStartTime = new InspectionTime();
                            inspStartTime.TimeID = Convert.ToInt32(btn.Uid);
                            inspStartTime.StartTime = btn.Text;
     
                            inspEndTime = new InspectionTime();
                            inspEndTime.TimeID = Convert.ToInt32(btn.Uid);
                            inspEndTime.EndTime = btn.Text;
     
     
     
                           // updateMileage = Convert.ToInt32(StartTime.Text.Trim());
                           // updateMileage = Convert.ToInt32(EndTime.Text.Trim());
     
     
                            {
             control.ShowErrorMessage("Litte Test." + inspStartTime.StartTime + " " + inspEndTime.EndTime,  MessageBoxImage.Exclamation);
                            }
    In the above code, i see inspStartTime.StartTime and inspEndTime.EndTime is being set the btn.Text value.
    May be that it why you get the same value in the messagebox ?
    Regards,
    MMH
    Rate my post if you find it usefull.

  3. #3
    Join Date
    Apr 2009
    Posts
    12

    Re: trying to get 2 separate values in alert box

    You are right, I was setting both to the same value. I separated them and it worked.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center