2015-05-31 19 views
-4

我想用c#發送一封電子郵件給sms程序。在正文中我想叫一個文本框,哪裏是什麼用戶價值放在那裏將是一個行有取代..是否可以在引號中間調用文本框C#VB

下面

是我的編碼:

public string FromAddress = "[email protected]"; 

    public string Password = "XXXXXXXXXX"; 

    public string To = "[email protected]"; 

    public string Subject = "isms"; 

    public string Body = 
    "STARTISMS 
    username:password:1 
    6017xxxxxxx, <-- here is where i want to call a textbox where it will 
         be replace with the value entered in the box at the 
         interface. 
    testing 1234567890 
    ENDISMS"; 

    public string Smtp = "smtp.gmail.com"; 

    public int Port = 587; 

請告訴我一個正確的方法來做到這一點..包括正確的方式如何寫在身體部分下面的多個文本

"STARTISMS 
username:password:1 
6017xxxxxxx, <-- here is where i want to call a textbox where it will be 
        replace with the value entered in the box at the 
        interface. 
testing 1234567890 
ENDISMS"; 
+1

您不能在字段聲明中執行此操作。這是基礎知識,你應該閱讀一本好書或者教程來詳細解釋這個。 – nvoigt

+0

謝謝! xD .... –

回答

0

不清楚!爲什麼你直接把財產投入財產?如果他們是靜態的,爲了使身體屬性,你可以點擊發送按鈕來製作它。

body = "S.T" + textBox1.Text; 

if else,說明你的問題清楚。

+0

ohh對不起,沒有說明上述代碼是在我的課,在按鈕或文本框我將數據綁定到屬性。例如: TextBox Text =「{Binding Model.Body}」 Body正在指示Body在我問的問題中的屬性..我使用wpf做了這個.. body =「S.T」+ textBox1.Text; 我想放一個這樣的文本框 body =「S.T + Texbox1.Text」可以完成任何其他詞「 ? –

相關問題