locked
textbox data display problem RRS feed

  • Question

  • I created 7 text boxes in my windows applin. i declare the 7 text boxes when i did not give any data to first text boxes means automatically it ll take 00.00 and also similar to all text boxes

    But if i give any data llike .59 (point five nine) means I need to show like this appearance 00.59 on when i was run my prog.........     help pls......

    VS 2005 and in vb.net

     

    Dim Y As TextBox = sender
                If Y.TabIndex >= 2 And Y.TabIndex <= 7 And Y.Text.Length <= 0 Then
                    Y.Text = "00.00"      // Y.Text = "00"+ "." +"00" //
                End If

     


    Nithiyanantham


    • Moved by edhickey Monday, August 22, 2011 2:38 PM (From:.NET 3.0/3.5 Windows Workflow Foundation)
    Saturday, August 20, 2011 1:52 PM

Answers

  • you can use <value>.ToString("00.00")

    Dim yValue As Double
    If Not Double.TryParse(Y.Text, yValue) Then yValue=0
    Y.Text = yValue.ToString("00.00")
    

     


    please, mark this as answer if it is THE answer
    ----------------
    Diego Cattaruzza
    Microsoft MVP - Visual Basic: Development
    blog: http://community.visual-basic.it/Diego
    web site: http://www.visual-basic.it
    • Proposed as answer by Liliane Teng Wednesday, August 24, 2011 10:01 AM
    • Marked as answer by Liliane Teng Thursday, August 25, 2011 2:20 PM
    • Unmarked as answer by Nithiyanantham Saturday, August 27, 2011 5:24 AM
    • Marked as answer by Nithiyanantham Saturday, August 27, 2011 5:25 AM
    Tuesday, August 23, 2011 10:47 AM

All replies

  • HI

    Expression Builder to format the display value .

     

    Regards

     

    Tuesday, August 23, 2011 10:11 AM
  • you can use <value>.ToString("00.00")

    Dim yValue As Double
    If Not Double.TryParse(Y.Text, yValue) Then yValue=0
    Y.Text = yValue.ToString("00.00")
    

     


    please, mark this as answer if it is THE answer
    ----------------
    Diego Cattaruzza
    Microsoft MVP - Visual Basic: Development
    blog: http://community.visual-basic.it/Diego
    web site: http://www.visual-basic.it
    • Proposed as answer by Liliane Teng Wednesday, August 24, 2011 10:01 AM
    • Marked as answer by Liliane Teng Thursday, August 25, 2011 2:20 PM
    • Unmarked as answer by Nithiyanantham Saturday, August 27, 2011 5:24 AM
    • Marked as answer by Nithiyanantham Saturday, August 27, 2011 5:25 AM
    Tuesday, August 23, 2011 10:47 AM
  • what is the meaning of using y.text and it shows the error on y. The error is Name y is not declared.
    Nithiyanantham
    Thursday, August 25, 2011 2:53 PM
  • Hi Nithiyanantham

    The Y.Text  come from your own code. When you declare it Dim Y as TextBox = Sender. I think Y stands for the sender TextBox(one of these 7 textboxes you created) and .Text should be the Text property.

    You are very close. Post the relevant code in order to sort it out. Have to see where did you put the code may help.


    Be a good forum member. Make this forum a great place to meet and interact with others around the world.
    Thursday, August 25, 2011 4:39 PM
  • Dim Y as TextBox = Sender

    This code is missing


    Nithiyanantham
    Saturday, August 27, 2011 5:26 AM
  • Thanks.....

    Nithiyanantham
    Saturday, August 27, 2011 5:27 AM
  • i am using one dropdownlist is inside the gridview in asp.net

    ddl.items.add("PRESENT");

    ddl.items.add("ABSENT");

    ddl.items.add("LEAVE");

    BUT i select the absent and after i click a submit button. but the data can be stored default as present.

    wt is problem. In my page_load event i used one if(!IsPostBack) one times.

    and the ddl is not enabled auto post back(false).

     

    foreach (GridViewRow gvr in GridView1.Rows)   //loop through GridView
            {
                b= new SqlCommand ("insert into attendance (stcode, stname, status, sex) values ('" + gvr.Cells[1].Text + "','" + gvr.Cells[2].Text + "','"+ ((DropDownList )gvr.Cells[0].Controls[1]).SelectedValue+"','"+gvr.Cells[3].Text +"')",a );
                a.Open();
                b.ExecuteNonQuery();
                a.Close();
                Label7.Visible = true;
                Label7.Text = "Updated";
            }

    thx in advance........


    Nithiyanantham
    Saturday, October 1, 2011 5:37 AM