很抱歉标题不好,因为我不知道如何调用标题我想保存文本框值,如果它是一个整数到名称为 IP 的配置文件,如果它是一个字符串到名称 DNS 这是代码 :
Public Class ServerSettings
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
If IPHostInfo.Text = "" Then ' here if it's a string save it to my.settings.dns
My.Settings.DNS() = IPHostInfo.Text
Else : IPHostInfo.Text = ""
My.Settings.IP() = IPHostInfo.Text 'and if it's an integer
End If
My.Settings.PORT() = IPInfo.Text
My.Settings.TOut() = TOut.Text
IPHostInfo.Text = IPHostInfo.Text
IPInfo.Text = IPInfo.Text
TOut.Text = TOut.Text
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
结束类