I want to populate my DataGridView (dgvMain) with Bitcoin price I get using webrequest API.
The Price example response from request: 36.560 should be populated in the row1 and 4th column (column(3))
My Code:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = False
getPriceBTC()
InitializeDataGridView()
End Sub
Private Sub InitializeDataGridView()
' Set the column header style.
Dim columnHeaderStyle As New DataGridViewCellStyle()
'columnHeaderStyle.BackColor = Color.Beige
columnHeaderStyle.Font = New Font("arial", 10, FontStyle.Bold)
dgvMain.ColumnHeadersDefaultCellStyle = columnHeaderStyle
' Set the column header names.
dgvMain.ColumnCount = 11
dgvMain.Columns(0).Name = "#"
dgvMain.Columns(0).Width = 50
dgvMain.Columns(1).Name = "ID"
dgvMain.Columns(2).Name = "Coin"
dgvMain.Columns(3).Name = "Price (EUR)"
dgvMain.Columns(4).Name = "Last 1h"
dgvMain.Columns(5).Name = "Last 24h"
dgvMain.Columns(6).Name = "Last 7d"
dgvMain.Columns(7).Name = "24h Volume"
dgvMain.Columns(8).Name = "M. Capital"
dgvMain.Columns(9).Name = "If Higher"
dgvMain.Columns(10).Name = "If Lower"
' Populate the rows.
Dim row1() As String = {"", "BTC", "BitCoin", "", "", " ", "", "", "", "", ""}
Dim row2() As String = {"", "ETH", "Ethereum", "", "", "", "", "", "", "", ""}
Dim row3() As String = {"", "ADA", "Cardano", "", "", "", "", "", "", "", ""}
Dim row4() As String = {"", "GLMR", "Moonbeam", "", "", "", "", "", "", "", ""}
Dim row5() As String = {"", "ELON", "Dogelon Mars", "", "", "", "", "", "", "", ""}
Dim row6() As String = {"", "MBOX", "Mobox", "", "", "", "", "", "", "", ""}
Dim row7() As String = {"", "BLOK", "Bloktopia", "", "", "", "", "", "", "", ""}
Dim row8() As String = {"", "STARL", "Starlink", "", "", "", "", "", "", "", ""}
Dim row9() As String = {"", "OOKI", "Ooki Protocol", "", "", "", "", "", "", "", ""}
Dim row10() As String = {"", "Floki", "Floki Inu", "", "", "", "", "", "", "", ""}
Dim row11() As String = {"", "EGC", "EverGrow Coin", "", "", "", "", "", "", "", ""}
Dim row12() As String = {"", "SQUID", "Squid Game", "", "", "", "", "", "", "", ""}
Dim row13() As String = {"", "HOT", "Holo", "", "", "", "", "", "", "", ""}
Dim row14() As String = {"", "ATLAS", "Star Atlas", "", "", "", "", "", "", "", ""}
Dim row15() As String = {"", "ZODI", "Zodium", "", "", "", "", "", "", "", ""}
Dim row16() As String = {"", "VML", "Meta Land", "", "", "", "", "", "", "", ""}
Dim row17() As String = {"", "SNN", "SeChain", "", "", "", "", "", "", "", ""}
Dim rows() As Object = {row1, row2, row3, row4, row5, row6, row7, row8, row9, row10, row11, row12, row13, row14, row15, row16, row17}
Dim rowArray As String()
For Each rowArray In rows
dgvMain.Rows.Add(rowArray)
Next rowArray
Dim chk As New DataGridViewCheckBoxColumn()
dgvMain.Columns.Add(chk)
chk.HeaderText = "Enable"
chk.Name = "chk"
chk.Width = 70
End Sub
Public Sub getPriceBTC()
Try
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
ServicePointManager.Expect100Continue = True
'Dim _price As String = txtCryptoPrice.Text
Dim _url As String = "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=EUR"
Dim _req As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(_url)
_req.Proxy = Nothing
_req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.81 Safari/537.36"
Dim _resp As System.Net.HttpWebResponse = _req.GetResponse
Dim streamReader As System.IO.StreamReader = New System.IO.StreamReader(_resp.GetResponseStream())
Dim API_source As String = streamReader.ReadToEnd
Dim _Fprice = API_source.ToLower.ToString
Dim _priceF = _Fprice.Substring(7)
Dim jsonprice As String = _priceF.Replace("}", "")
Dim row As DataGridViewRow = Nothing
For Each item As DataGridViewRow In dgvMain.Rows
row = item
row.Cells(3).Value = jsonprice
Next
_runningThreads.Remove(Thread.CurrentThread)
Catch ex As Exception
End Try
End Sub
I added piece of CODE after I edited but it shows now in all CELLS
the btc price so how DO I add it only to the first row?
row.Cells(3).Value = jsonprice
heheheh I google it :p
dgvMain.Rows(0).Cells(3).Value = jsonprice
yeees!
Related
I am working UWP (Visual Basic) I am fetching data from one site which replies in JSON string format.
[
{"id": 1, "name": "Johny", "lname": "Sins", "phone": 123456789},
{"id": 2, "name": "Nike", "lname": "Jons", "phone": 23456789}
]
here is my code how I get it: -
Dim url As String = "http://127.0.0.1:8000/getdata/"
Dim Request As HttpWebRequest = HttpWebRequest.Create(url)
Request.Proxy = Nothing
Request.UserAgent = "Test"
Dim Response As HttpWebResponse = Request.GetResponse
Dim ResponseStream As System.IO.Stream = Response.GetResponseStream
Dim StreamReader As New System.IO.StreamReader(ResponseStream)
Dim Data As String = StreamReader.ReadToEnd
StreamReader.Close()
Now I want to print this data One by One in one text box, so how do I convert in to json array and print it?
I tested the parsing part with your Json data. Please refer to the method
Public Class node
Public Property id As Integer
Public Property name As String
Public Property lname As String
Public Property phone As Integer
End Class
Public Sub JsonTest()
Try
Dim json_test As String = "[
{'id': 1, 'name': 'Johny', 'lname': 'Sins', 'phone': 123456789},
{'id': 2, 'name': 'Nike', 'lname': 'Jons', 'phone': 23456789}
] "
Dim nodelist As List(Of node) = JsonConvert.DeserializeObject(Of List(Of node))(json_test)
For Each n In nodelist
Console.WriteLine(n.id)
Console.WriteLine(n.name)
Console.WriteLine(n.lname)
Next
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Output Expected: I want to return the combinations of 2, in the case below, each separated by a comma and vbcrlf, for example:
1,2
3,4
5,6
and so on...
the problem is that this code below does not.
It returns my values in the line (1,2,3,4,5,6,7,8,9,10,11,12 .. and so on.
how do I make the code from button1 work properly?
Function GetCombinations(ByVal depth As Integer, ByVal values As String()) As IEnumerable(Of String)
If depth > values.Count + 1 Then Return New List(Of String)
Dim result = New List(Of String)
For i = 0 To depth - 1
For y = 0 To values.Count - 1
If i = 0 Then
result.Add(values(y))
Else
result.Add(values(i - 1) + values(y))
End If
Next
Next
Return result
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim data_array As String() = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14",
"15"}
Dim result = GetCombinations(2, data_array)
Dim resultx As String = String.Join(",", result)
TxtListScanTxt.AppendText(resultx)
End Sub
This is one way to do it - tested and working
Public Sub Main()
Dim data_array As String() = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14",
"15"}
dim second as boolean
dim sb = new stringbuilder()
For i as integer = 0 To data_array.Length - 1
if second then
sb.AppendLine(data_array(i -1) & "," & data_array(i))
second = false
continue for
end if
if i = data_array.Length - 1 then
sb.AppendLine(data_array(i))
end if
second = true
next
Console.WriteLine(sb.ToString())
End Sub
my solution
Dim data_array As String() = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14",
"15"}
Dim depth As Integer = 3, i As Integer = 1
Dim result As StringBuilder = New StringBuilder
For y = 0 To data_array.Count - 1
If i < depth Then
result.Append(data_array(y) + ",")
i += 1
Else
result.Append(data_array(y) + vbNewLine)
i = 1
End If
Next
RichTextBox1.AppendText(result.ToString)
Sub Main(args As String())
Dim arr = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"}
'// First, we join all array values with comma to get a string.
'// Second, we find each group of two digits separated by comma (\d+,\d+)
'// and replace it ($1) with the same group PLUS the new-line character.
Dim x = Regex.Replace(String.Join(",", arr), "(\d+,\d+),?", $"$1{vbCrLf}")
End Sub
I am in the midst of writing a simple encryptor/decryptor program and have run into a small issue. All the characters are being generated a different string of characters to uniquely identify them. These strings are meant to be all the same length but don't seem to be. The code in question: (Full code can be viewed here)
Dim genLength As Integer = 0
Dim charNow As Integer = 0
Dim charGenned As String
Dim rndGend As Integer = 0
While genLength < enhancedMode
fs.Write(arrayAll(charNow))
Dim rndString As String = ""
While rndGend < encLength
Randomize()
Dim genned As Integer = CInt(Math.Ceiling(Rnd() * 46)) + 1
charGenned = arrayAll(genned)
rndString = rndString + charGenned
rndGend += 1
End While
fs.Write(rndString & vbNewLine)
rndGend = 0
charNow = charNow + 1
genLength = genLength + 1
End While
From what I can tell this should give me the result I am looking for, but the generated strings are not at all consistent in length. A sample of the output:
alh*ph)lufe$2fz!d7c0$qfd(ol6f173#
b^i24#^v0gx%01iqrpugg8)(mqsl8%
c1km5jnz0hti&u$#rqeh5ism31t^96^
dkx&6$ok!#u#*e^x6659jpvcnn258zpi
e%y1(y3%#w9kk9&h7d6gw)w72*3c9*d)j
fy#(i4yeg0%ltj#887!x4!e32^703e4l
gj$4#5&f!!zzdkvs)v##94)*rcmroy
While the string after the letter A is 32 digits long, as is for B, and C, when you get to G, the string is only 29 characters long. It is most noticeable in the fact that the program only generates strings for characters up to numeral 5, then stops:
3%y1(y3%#w9kk9&h7d6gw)w72*3c9*d)j
4y#(i4yeg0%ltj#887!x4!e32^703e4l
5j$4#5&f!!zzdkvs)
What is going amiss here?
I just tidied up a bit and changed to the Random class which I think is much easier to use. If you declaring an array in vb.net remember it is Dim variable(ubound) As Type. ubound stands for the Upper bound of the array, the highest index so an array with 47 elements would have indexes 0-46. The ubound would be 46 Dim variable(46) As String
Private r As New Random
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Button1.Enabled = False
Dim arrayLetters() As String = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
Dim arrayAll() As String = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "!", "#", "#", "$", "%", "^", "&", "*", "(", ")"}
Dim encLength As Integer = 16
If CheckBox2.Checked = True Then
encLength = 32
End If
Dim enhancedMode As Integer = 26
If CheckBox1.Checked = True Then
enhancedMode = 46
End If
Dim genLength As Integer = 0
Dim charNow As Integer = 0
Dim charGenned As String
Dim rndGend As Integer = 0
Dim sb As New StringBuilder
While genLength < enhancedMode
sb.Append(arrayAll(charNow))
Dim rndString As String = ""
While rndGend < encLength
Dim genned As Integer = r.Next(0, 46)
charGenned = arrayAll(genned)
rndString &= charGenned
rndGend += 1
End While
sb.AppendLine(rndString)
rndGend = 0
charNow += 1
genLength += 1
End While
Dim name As String
If TextBox1.Text = "" Then
name = "KeyGenned"
Else
name = TextBox1.Text
End If
Dim path As String = Application.StartupPath & "\" & name & ".txt"
File.WriteAllText(path, sb.ToString)
Close()
End Sub
I have a Winforms vb.net app that sends pdfs to docusign for signing. Here is my issue.
Scenario #1: pdf #1 sent alone and all tabs show as expected
Scenario #2: pdf #2 sent alone and all tabs show as expected
Scenario #3: pdf #1 & pdf #2 sent together, 4 of the 6 tabs are missing on pdf #1. The tabs missing are Initial, DateSigned and Date. Signature & FullName show as expected for pdf #1. All tabs also show correctly for pdf #2.
I am using pretty unique AnchorStrings for the missing tabs. But the Signature & FullName AnchorStrings are the same for both documents.
I am also identifying the DocumentId, RecipientId and PageNumber as required per the API Reference.
I am coming to the conclusion we will have to send each document desperately.
'Public Sub SendForSignature(ByRef Docs As List(Of DocToSign), DocSigner As Signer)
Try
If Not UserHasLogin(User.Id) Then
Throw New Exception("You do not have DocuSign credentials saved. Save your credentials in your User Settings to use DocuSign.")
End If
If Docs.Count = 0 Then
Exit Try
End If
If String.IsNullOrWhiteSpace(DocSigner.Name) Then
Throw New Exception("No recipient name found.")
End If
If String.IsNullOrWhiteSpace(DocSigner.Email) Then
Throw New Exception("No recipient email address found.")
End If
If String.IsNullOrWhiteSpace(DocSigner.RecipientId) Then
DocSigner.RecipientId = "1"
End If
If String.IsNullOrWhiteSpace(DocSigner.RoutingOrder) Then
DocSigner.RoutingOrder = "1"
End If
'Create Envelope
Dim envDef As New EnvelopeDefinition() With {
.EmailSubject = $"Signature Requested from {User.FirstName}",
.EmailBlurb = "Please sign the document. Thank you!"}
envDef.Documents = New List(Of Document)()
envDef.CustomFields = New CustomFields()
envDef.Recipients = New Recipients()
'Used for Documentid
Dim i As Integer = 1
For Each pdf As DocToSign In Docs
If Not File.Exists(pdf.Path) Then
Throw New Exception($"PDF file was not found at '{pdf.Path}'.")
End If
If Not Path.GetExtension(pdf.Path).ToLower.EndsWith("pdf") Then
Throw New Exception("File path did not end with pdf, invalid file format.")
End If
Dim filebytes As Byte() = File.ReadAllBytes(pdf.Path)
Dim lcf As New List(Of ListCustomField)
lcf.Add(New ListCustomField With {.Name = "ReferenceGUID", .Value = pdf.ReferenceGUID, .Required = "true", .Show = "false"})
lcf.Add(New ListCustomField With {.Name = "UserId", .Value = User.Id.ToString, .Required = "true", .Show = "false"})
envDef.CustomFields.ListCustomFields = lcf
'Add a document to the envelope
Dim doc As New Document()
doc.DocumentBase64 = Convert.ToBase64String(filebytes)
doc.Name = Path.GetFileName(pdf.Path)
doc.DocumentId = i.ToString()
doc.DocumentFields = New List(Of NameValue)
doc.DocumentFields.Add(New NameValue With {.Name = "ReferenceGUID", .Value = pdf.ReferenceGUID})
doc.ApplyAnchorTabs = "true"
envDef.Documents.Add(doc)
'Move Tabs per Document
Select Case pdf.DocumentTypeId
Case 2 'Client Lease
'Change for Master Leases
If pdf.IsSubLease Then
Else
SetupClientLease(DocSigner, i.ToString)
End If
Case 18 'Client NTV
SetupClientNTV(DocSigner, i.ToString)
Case 7 'Addendum
SetupClientAddendum(DocSigner, i.ToString)
Case 6 'SOP
SetupClientSOP(DocSigner, i.ToString)
Case 41 'Master Rental Agreement
Dim ECHSigner As New Signer With {.Name = User.FullName, .Email = User.EmailAddress, .RecipientId = "2", .RoutingOrder = "1"}
DocSigner.RoutingOrder = "2"
envDef.Recipients.Signers.Add(ECHSigner)
SetupMasterRentalAgreement(DocSigner, ECHSigner, i.ToString)
End Select
'Set next doc id
i += 1
Next
'Add a recipient to sign the documeent
envDef.Recipients.Signers = New List(Of Signer)()
envDef.Recipients.Signers.Add(DocSigner)
'Set envelope status to "sent" to immediately send the signature request
envDef.Status = "sent"
'Use the EnvelopesApi to send the signature request!
Dim envelopesApi As New EnvelopesApi()
Dim envelopeSummary As EnvelopeSummary = envelopesApi.CreateEnvelope(accountid, envDef)
Catch ex As Exception
Throw New Exception(ex.Message, ex.InnerException)
End Try
End Sub
Private Sub SetupClientNTV(ByRef signer As Signer, DocId As String)
Try
' Create a |SignHere| tab somewhere on the document for the recipient to sign
signer.Tabs = New Tabs()
signer.Tabs.SignHereTabs = New List(Of SignHere)
signer.Tabs.InitialHereTabs = New List(Of InitialHere)
signer.Tabs.DateTabs = New List(Of [Date])
signer.Tabs.FullNameTabs = New List(Of FullName)
signer.Tabs.DateSignedTabs = New List(Of DateSigned)
'Signature Tab
Dim signHere As New SignHere() With {
.AnchorString = "Guest Signature",
.AnchorXOffset = "2",
.AnchorYOffset = "-12",
.DocumentId = DocId,
.RecipientId = "1",
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1"}
'Full Name Tab
Dim fullName As New FullName With {
.AnchorString = "Guest Printed Name",
.AnchorXOffset = "0",
.AnchorYOffset = "-12",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1"}
'Date Signed Tabs
Dim dateSigned As New DateSigned() With {
.AnchorString = "Date Signed",
.AnchorXOffset = "0",
.AnchorYOffset = "-12",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1"}
'Date Tabs
Dim ntvdate As New [Date] With {
.AnchorString = "Initial ONLY ONE",
.AnchorXOffset = "292",
.AnchorYOffset = "26",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1",
.ConditionalParentLabel = "initial1",
.ConditionalParentValue = "on",
.Width = 100}
'Initial Tabs
Dim initial1 As New InitialHere With {
.AnchorString = "Initial ONLY ONE",
.AnchorXOffset = "2",
.AnchorYOffset = "41",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1",
.Optional = "true",
.TabLabel = "initial1",
.ScaleValue = "0.75"} 'Scale value is size - 1.0 is full size, 0.5 is 50% size
Dim initial2 As New InitialHere With {
.AnchorString = "Initial ONLY ONE",
.AnchorXOffset = "2",
.AnchorYOffset = "82",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1",
.Optional = "true",
.TabLabel = "initail2",
.ScaleValue = "0.75"}
signer.Tabs.SignHereTabs.Add(signHere)
signer.Tabs.DateTabs.Add(ntvdate)
signer.Tabs.FullNameTabs.Add(fullName)
signer.Tabs.DateSignedTabs.Add(dateSigned)
signer.Tabs.InitialHereTabs.Add(initial1)
signer.Tabs.InitialHereTabs.Add(initial2)
Catch ex As Exception
Throw New Exception(ex.Message, ex.InnerException)
End Try
End Sub
Private Sub SetupClientSOP(ByRef signer As Signer, DocId As String)
Try
' Create a |SignHere| tab somewhere on the document for the recipient to sign
signer.Tabs = New Tabs()
signer.Tabs.SignHereTabs = New List(Of SignHere)
signer.Tabs.TextTabs = New List(Of Text)
signer.Tabs.FullNameTabs = New List(Of FullName)
signer.Tabs.DateSignedTabs = New List(Of DateSigned)
signer.Tabs.RadioGroupTabs = New List(Of RadioGroup)
Dim rg As New RadioGroup With {
.DocumentId = DocId,
.GroupName = "radios",
.RecipientId = "1",
.Radios = New List(Of Radio)}
'Signature Tab
Dim signHere As New SignHere() With {
.AnchorString = "Guest Signature",
.AnchorXOffset = "3",
.AnchorYOffset = "-11",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1"}
'Radio Tabs
Dim radio1 As New Radio With {
.AnchorString = "Credit Card on File",
.AnchorXOffset = "-27",
.AnchorYOffset = "-3",
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.Required = "true",
.Selected = "true",
.PageNumber = "1"}
Dim radio2 As New Radio With {
.AnchorString = "Auto Debit my",
.AnchorXOffset = "-27",
.AnchorYOffset = "-3",
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.Required = "true",
.Selected = "false",
.PageNumber = "1"}
Dim radio3 As New Radio With {
.AnchorString = "Postal Mail (",
.AnchorXOffset = "-27",
.AnchorYOffset = "-3",
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.Required = "true",
.Selected = "false",
.PageNumber = "1"}
Dim radio4 As New Radio With {
.AnchorString = "Wire Transfer",
.AnchorXOffset = "-27",
.AnchorYOffset = "-3",
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.Required = "true",
.Selected = "false",
.PageNumber = "1"}
'Text Tabs (For email address - Using EmailAddress is not optional)
Dim emailHere As New Text With {
.AnchorString = "Email address where invoices should be sent:",
.AnchorXOffset = "160",
.AnchorYOffset = "-3",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.Required = "false",
.PageNumber = "1",
.Width = 225}
'Full Name Tab
Dim fullName As New FullName With {
.AnchorString = "Guest Printed Name",
.AnchorXOffset = "0",
.AnchorYOffset = "-11",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1"}
'Date Tab
Dim dateHere As New DateSigned() With {
.AnchorString = "Date:",
.AnchorXOffset = "20",
.AnchorYOffset = "-3",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.PageNumber = "1"}
rg.Radios.Add(radio1)
rg.Radios.Add(radio2)
rg.Radios.Add(radio3)
rg.Radios.Add(radio4)
signer.Tabs.SignHereTabs.Add(signHere)
signer.Tabs.RadioGroupTabs.Add(rg)
signer.Tabs.TextTabs.Add(emailHere)
signer.Tabs.FullNameTabs.Add(fullName)
signer.Tabs.DateSignedTabs.Add(dateHere)
Catch ex As Exception
Throw New Exception(ex.Message, ex.InnerException)
End Try
End Sub`
Request Body
'{
"documents": [
{
"documentId": "1",
"name": "2teevgqk2dm.pdf",
"documentFields": [
{
"name": "ReferenceGUID",
"value": "2582db83-cf6e-4611-9daf-321f40a7440a"
}
],
"documentBase64": "[Base64 data omitted]",
"applyAnchorTabs": "true"
},
{
"documentId": "2",
"name": "dwwkrtmjwk3.pdf",
"documentFields": [
{
"name": "ReferenceGUID",
"value": "2582db83-cf6e-4611-9daf-321f40a7440a"
}
],
"documentBase64": "[Base64 data omitted]",
"applyAnchorTabs": "true"
}
],
"recipients": {
"signers": [
{
"tabs": {
"signHereTabs": [
{
"documentId": "2",
"pageNumber": "1",
"anchorString": "Guest Signature",
"anchorXOffset": "3",
"anchorYOffset": "-11",
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true"
}
],
"fullNameTabs": [
{
"documentId": "2",
"pageNumber": "1",
"anchorString": "Guest Printed Name",
"anchorXOffset": "0",
"anchorYOffset": "-11",
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true"
}
],
"dateSignedTabs": [
{
"documentId": "2",
"pageNumber": "1",
"anchorString": "Date:",
"anchorXOffset": "20",
"anchorYOffset": "-3",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true"
}
],
"textTabs": [
{
"width": 225,
"required": "false",
"documentId": "2",
"pageNumber": "1",
"anchorString": "Email address where invoices should be sent:",
"anchorXOffset": "160",
"anchorYOffset": "-3",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true"
}
],
"radioGroupTabs": [
{
"documentId": "2",
"recipientId": "1",
"groupName": "radios",
"radios": [
{
"pageNumber": "1",
"anchorString": "Credit Card on File",
"anchorXOffset": "-27",
"anchorYOffset": "-3",
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true",
"selected": "true",
"required": "true"
},
{
"pageNumber": "1",
"anchorString": "Auto Debit my",
"anchorXOffset": "-27",
"anchorYOffset": "-3",
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true",
"selected": "false",
"required": "true"
},
{
"pageNumber": "1",
"anchorString": "Postal Mail (",
"anchorXOffset": "-27",
"anchorYOffset": "-3",
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true",
"selected": "false",
"required": "true"
},
{
"pageNumber": "1",
"anchorString": "Wire Transfer",
"anchorXOffset": "-27",
"anchorYOffset": "-3",
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true",
"selected": "false",
"required": "true"
}
]
}
]
},
"name": "Joe Blow",
"email": "test#test.com",
"recipientId": "1",
"routingOrder": "1"
}
]
},
"customFields": {
"listCustomFields": [
{
"name": "ReferenceGUID",
"show": "false",
"required": "true",
"value": "2582db83-cf6e-4611-9daf-321f40a7440a"
},
{
"name": "UserId",
"show": "false",
"required": "true",
"value": "14"
}
]
},
"status": "sent",
"emailSubject": "Signature Requested",
"emailBlurb": "Please sign the document. Thank you!"
}'
Yes, each document gets its own id, unique for the envelope. And each anchor (autoplace) tab needs to include a documentId which specifies the document the tab belongs to.
If you have two documents and each gets a SignHere tab, then you need two different SignHere tab definitions, one for each document. It doesn't matter that the two tabs use the same anchor string text.
It appears the issue was that I was creating multiple list of tabs instead of just one list for each tab type. So only the first list was working.
I had to add the following code before I looped through to setup the tabs for each document.
DocSigner.Tabs = New Tabs()
DocSigner.Tabs.SignHereTabs = New List(Of SignHere)
DocSigner.Tabs.InitialHereTabs = New List(Of InitialHere)
DocSigner.Tabs.TextTabs = New List(Of Text)
DocSigner.Tabs.FullNameTabs = New List(Of FullName)
DocSigner.Tabs.DateSignedTabs = New List(Of DateSigned)
DocSigner.Tabs.RadioGroupTabs = New List(Of RadioGroup)
DocSigner.Tabs.TitleTabs = New List(Of Title)
DocSigner.Tabs.DateTabs = New List(Of [Date])
So I am trying to make the card game WAR in visual basic 2010. I have the following code and I kind of know what I need to do next but I just can't get to the next step.
Public Class form1
'throws an error unless this is the first class in the file
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'click the button currently labled "loop"
Dim Cards() As String = {"Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack"} 'spades,hearts/diamonds,clubs
Dim Values() As String = {"11", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"} 'faces is a term meaning a card that depicts a person
Dim suits() As String = {"H", "D", "C", "S"}
Dim p1deck()() As String '
'first (0) is the number of the array
'second(0) is the string
p1deck(0)(0) = "Ace"
p1deck(0)(1) = "11"
p1deck(0)(2) = "Hearts"
TextBox1.Text = p1deck(0)(0) & " of " & p1deck(0)(2)
'Cards.ToList(). add/removeAt
End Sub
End Class
You are not Initializing your p1deck array.
Try something like this:
Dim p1deck(2, 3) As String
p1deck(0, 0) = "Ace"
p1deck(0, 1) = "11"
p1deck(0, 2) = "Hearts"
TextBox1.Text = p1deck(0, 0) & " of " & p1deck(0, 2)