窗体设计界面如下:
My.Resources.Resource1.WindowString1
具体代码如下:
调用字符串资源:
Dim resStringIndex As Integer Private Sub Button1_Click(sender As Object,e As EventArgs) Handles Button1.Click Select Case resStringIndex Case 1 TextBox1.Text = My.Resources.Resource1.WindowString1 resStringIndex = 2 Case 2 TextBox1.Text = My.Resources.Resource1.WindowString2 resStringIndex = 3 Case 3 TextBox1.Text = My.Resources.Resource1.WindowString3 resStringIndex = 1 End Select End Sub Private Sub Form1_Load(sender As Object,e As EventArgs) Handles MyBase.Load resStringIndex = 1 End Sub
Private Sub Button2_Click(sender As Object,e As EventArgs) Handles Button2.Click PictureBox1.Image = My.Resources.Resource1.BoldB PictureBox2.Image = My.Resources.Resource1.RedoB PictureBox3.Image = My.Resources.Resource1.UndoB End Sub
Private Sub Button3_Click(sender As Object,e As EventArgs) Handles Button3.Click TextBox2.Text = My.Resources.Resource1.bbb End Sub
运行后效果如下:
由于.net平台下C#和vb.NET很相似,本文也可以为C#爱好者提供参考。
学习更多vb.net知识,请参看vb.net 教程 目录