变量内部对象?

时间:2013-02-07 22:32:23

标签: vb.net variables resources

如何将变量放入My.Resources,例如

My.Resources.[var]

这是我的代码:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  For Each Fe In My.Resources.ResourceManager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, False, True)
    ProgressBar1.Maximum += 1
    ' MsgBox(Fe.Key)

    My.Computer.FileSystem.WriteAllBytes _
       (appath & "\bin\" & Fe.Key & ".jpeg", My.Resources.F.Key, True) 'Fe.Key As Variable

  Next
End Sub

如何在My.Resources中使用Fe.Key?

2 个答案:

答案 0 :(得分:1)

自从您询问密钥后,可能还有一些问题需要补充。试试这个:

Dim RSet As Resources.ResourceSet = My.Resources.ResourceManager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, False, True)

If RSet IsNot Nothing Then

    Dim enumerator As IDictionaryEnumerator = RSet.GetEnumerator

    While (enumerator.MoveNext)

     ' You can now use enumerator.key

    End While   

End If

Source

答案 1 :(得分:0)

解决了.☺

Here

引用:

My.Resources.ResourceManager.GetObject(var)