none
help me please RRS feed

  • Question

  • can you tell me how to gather two textboxes

    for example:   textbox1=textbox2 * 1

    what are syntax should be used.

    help me please!!!

    Thursday, September 30, 2010 6:37 PM

Answers

  • I agree with Jan.

    Hereis some code that will loop through every task in a Microsoft Project Schedule and multiply [Text1] times [Number1].  Since I have no idea what is contained in Text1, I can not promise any proper result.  I will write the result to Text3.

    Dim tsk as Task

    For Each tsk in ActiveProject.Tasks

    tsk.Text3.Text=tsk.Text1.ToString * tsk.Number1.value

    Next tsk

    The value "Me" refers to an object you are trying to manipulate.  If you are using the code on a Form, then Me refers to the form.

    A better solution would be to cast the values as numbers.  For example, integers:

    tsk.Text3.text = Cint(tsk.text1.value)*cint(tsk.Number1.value)

    These are answers assuming you are working with a Microsoft Project (*.mpp) file within a Visual Studio application.

    If you are not talking about a task object within a microsoft project (.mpp) file being manipulated by a Visual Studio application, you should post somewhere else. There are many VB.NET forums, this is not one of them.


    If you feel this post answered the question, please vote for it. I am also available here:
    msprojectblog.com
    • Marked as answer by Jim Corbin Friday, October 1, 2010 7:59 PM
    Thursday, September 30, 2010 8:25 PM
    Moderator

All replies

  • Hi,

    Maybe I lack the imagination, but I absolutely don't have a clue on what you mean. Multiplying text boxes? Can you be a bit more specific?

    Thursday, September 30, 2010 7:14 PM
    Moderator
  • Assuming you mean two text boxes for the same task into a third textbox:

    (Assume tsk is an object of type "Task")

    For Visual Basic:

    tsk.Text1.text = tsk.Text2.text.tostring & " " & tsk.Text3.text.tostring

    or if you like:

    tsk.Text1.text = tsk.Text2.text.tostring & " Hello World"

    The ampersand (&) is used to concatenate the two together.  The " " places a space between the two strings.

    If you are using a formula within project (say in a column):

    [Text2] & [Text3] & " Hello World"

    other than that, same rules will apply.

    Are we anywhere close to answering your question?


    If you feel this post answered the question, please vote for it. I am also available here:
    msprojectblog.com
    Thursday, September 30, 2010 7:22 PM
    Moderator
  • i want to multiply texbox first with number 1 and score that appears in texbox 2

    I don't speak very good english..sorry

    do you understand ask now??

    Thursday, September 30, 2010 7:22 PM
  • You may have problems, since Text and Numbers may not multiply as you assume.

    Try this to start:

    [Text1]*[Number1]

    The formula will use the values in the Text1 and Number1 columns to compute an answer. 

    I think this information, with the other post, may be helpful.

    Are you trying to do this in VBA or as a formula for a column?

    Can you give us an example of what is in "Text" and "Number" fields you wish to multiply?  Would it be better to use two Number fields?

    [Number1]*[Number2]

     


    If you feel this post answered the question, please vote for it. I am also available here:
    msprojectblog.com
    • Marked as answer by nardi nardi Thursday, September 30, 2010 7:34 PM
    • Unmarked as answer by nardi nardi Thursday, September 30, 2010 7:34 PM
    Thursday, September 30, 2010 7:27 PM
    Moderator
  • dear Jim Askel I write on visual studio    Me.textbox1.text = me.textbox2.text * 1      but my computer don't accept ME before textbox1
    Thursday, September 30, 2010 7:38 PM
  • Hi,

    Could it be that this is unrelated to Microsoft Project (the topic of this forum)?

    What is Me supposed to represent?

    Thursday, September 30, 2010 7:47 PM
    Moderator
  • I agree with Jan.

    Hereis some code that will loop through every task in a Microsoft Project Schedule and multiply [Text1] times [Number1].  Since I have no idea what is contained in Text1, I can not promise any proper result.  I will write the result to Text3.

    Dim tsk as Task

    For Each tsk in ActiveProject.Tasks

    tsk.Text3.Text=tsk.Text1.ToString * tsk.Number1.value

    Next tsk

    The value "Me" refers to an object you are trying to manipulate.  If you are using the code on a Form, then Me refers to the form.

    A better solution would be to cast the values as numbers.  For example, integers:

    tsk.Text3.text = Cint(tsk.text1.value)*cint(tsk.Number1.value)

    These are answers assuming you are working with a Microsoft Project (*.mpp) file within a Visual Studio application.

    If you are not talking about a task object within a microsoft project (.mpp) file being manipulated by a Visual Studio application, you should post somewhere else. There are many VB.NET forums, this is not one of them.


    If you feel this post answered the question, please vote for it. I am also available here:
    msprojectblog.com
    • Marked as answer by Jim Corbin Friday, October 1, 2010 7:59 PM
    Thursday, September 30, 2010 8:25 PM
    Moderator
  • thank you very much for your attempt Jim and Jan, I found the problem
    Friday, October 1, 2010 12:07 PM