ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Textbox query (https://www.excelbanter.com/excel-programming/378860-textbox-query.html)

Greg B[_9_]

Textbox query
 
Hi all

I am making a userform and I cant think how to get this to work. I am
trying to add textbox2 value to textbox3's ie 2 + 6 = 8

Here is the code I am using. Sorry I have a bit of brain fade.

TOTPEGS.Caption = TextBox2.Value + TextBox3.Value



Greg B[_9_]

Textbox query
 
Sorry it is wrong I mean
textbox8.value = TextBox2.Value + TextBox3.Value


"Greg B" wrote in message
...
Hi all

I am making a userform and I cant think how to get this to work. I am
trying to add textbox2 value to textbox3's ie 2 + 6 = 8

Here is the code I am using. Sorry I have a bit of brain fade.

TOTPEGS.Caption = TextBox2.Value + TextBox3.Value



Helmut Weber[_2_]

Textbox query
 
Hi,

caption expects a string.

object.Caption [= String]

A textbox contains a string, not a number.

Private Sub CommandButton1_Click()
UserForm1.Caption = _
CStr(CLng(TextBox1.Value) + CLng(TextBox2.Value))
End Sub

HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

on strange territory

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"




Hi all

I am making a userform and I cant think how to get this to work. I am
trying to add textbox2 value to textbox3's ie 2 + 6 = 8

Here is the code I am using. Sorry I have a bit of brain fade.

TOTPEGS.Caption = TextBox2.Value + TextBox3.Value




All times are GMT +1. The time now is 05:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com