2016-01-15 62 views
0

基本問題,但我找不到解決方案。這是我的代碼:如何在執行時更改/設置窗口標題? Visual Basic

Imports System 
Imports System.Xml 


Public Class Etiquetes 

Private Sub saveXML_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles saveXML.Click 
    Dim settings As New XmlWriterSettings() 
    settings.Indent = True 

    Me.Text = "The title I want" 

    Dim XmlWrt As XmlWriter = XmlWriter.Create("C:\Documents and Settings\dpradell\Etiqueta.xml", settings) 

    With XmlWrt 



     .WriteStartElement("Production") 
     .WriteAttributeString("xmlns", "xsd", Nothing, "http://www.w3.org/2001/XMLSchema") 
     .WriteAttributeString("xmlns", "xsi", Nothing, "http://www.w3.org/2001/XMLSchema-instance") 

     .WriteStartElement("Order") 

     .WriteStartElement("Attribute") 
     .WriteAttributeString("Type", "NumReparacio") 
     .WriteAttributeString("Value", txtNumReparacio.Text.ToString()) 
     .WriteEndElement() 


    End With 

    MessageBox.Show("XML guardat") 
End Sub 

End Class 

因此,大家可以看到,我知道如何去改變它,當我點擊這個按鈕:

Me.Text = "The title I want" 

但我怎麼申請執行之前設置呢?或者我該如何在開始時更改它?非常感謝你!

+0

似乎要在這裏回答:http://stackoverflow.com/questions/17847418/how-do-i-change-the-window-title-after-starting-something-with-process-start –

+0

不解決我的問題 –

回答

1

這是非常簡單的(一旦我發現它是)

My.Forms.Form1.Text = "Whatever name you want here" 

這種添加到您的窗體的Load事件處理程序。