如何在执行时更改/设置窗口标题? Visual Basic

时间:2016-01-15 11:23:16

标签: vb.net window title execution

基本问题,但我找不到解决方法。这是我的代码:

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"

但是如何在应用程序执行之前设置它?或者如何在它启动时更改它?非常感谢你!

1 个答案:

答案 0 :(得分:1)

它很简单(一旦我发现它就是这样)

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

将此添加到表单的加载事件处理程序中。