Value of type string cannot be converted and property is readonly RRS feed

  • Question

  • Already asked this question in stackoverflow and bitcoin stackexchange forums but nothing helpful. So the problem is that I want to use few values entered by user at run time in textboxes but I cannot assign them directly being string to variables that are part of a class and read only. It was easier to do the opposite which is convert one of these values to string and display as label etc.

    Here is the code:

    Imports NBitcoin
    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Dim bob As New Key
            Dim alice As New Key
            Dim satoshi As New Key
           'bob.PubKey = TextBox1.Text
           'alice.PubKey = TextBox2.Text
           'satoshi.PubKey = TextBox3.Text
            Dim redeemScript As Script = PayToMultiSigTemplate.Instance.GenerateScriptPubKey(2, {bob.PubKey, alice.PubKey, satoshi.PubKey})
            Label1.Text = redeemScript.Hash.GetAddress(Network.TestNet).ToString
        End Sub
    End Class

    Links to the other two forums where I asked the same question:



    Saturday, August 8, 2020 3:37 AM

All replies

  • Hi Boboshi,

    Thank you for posting here.

    According to your description, your problem is more related to NBitcoin library, so I suggest you post your question in NBitcoin forum for more efficient responses.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 10, 2020 6:10 AM