Value of type string cannot be converted and property is readonly

  • Thread starter Thread starter Boboshi
  • Start date Start date
B

Boboshi

Guest
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:

Value of type 'string' cannot be converted and property is readonly

Assign values of public keys from textboxes using NBitcoin

Continue reading...
 
Back
Top