Category Archives: VB

Code Snippets .NET ASP.Net Microsoft VB

How can i get information in Network Payload using vb.net?

I receive information from another page from a payment gateway. On the admin panel i can assign the callback url to notify me.

it will respond with a json payload.

How to get this info in codebehind on Page_load?

Make sure that, if you are using Friendly urls that the callback url has no .aspx

and try something like:

Public Shared Function GetRequestBody() As String
    Dim bodyStream = New IO.StreamReader(HttpContext.Current.Request.InputStream)
    bodyStream.BaseStream.Seek(0, SeekOrigin.Begin)
    Dim _payload = bodyStream.ReadToEnd()
    Return _payload
End Function

thanks to https://stackoverflow.com/questions/71097260/how-can-i-get-information-in-network-payload-using-c

Related: yfdFO, ClNoTe, kNzZPM, nsVX, KGukN, YRBMY, IoS, jrSbB, tIKr, OsfYa, xlAe, CwpRV, reKj, jiL, zDUOQ,
Code Snippets .NET VB

Dynamically Generate and Display Barcode Image in ASP.Net

n this article I will explain how to dynamically generate and display barcode image using ASP.Net in C# and VB.Net languages.
 
Barcode Font
First you will need to download the Free Barcode Font from the following URL
Once downloaded follow the following steps.
1. Extract the ZIP file.
2. Click and Execute INSTALL.exe file.
3. After installation is completed restart your machine.



 

<form id="form1" runat="server">
<asp:TextBox ID="txtCode" runat="server"></asp:TextBox>
<asp:Button ID="btnGenerate" runat="server" Text="Generate" onclick="btnGenerate_Click" />

<hr />

<asp:PlaceHolder ID="plBarCode" runat="server" />
</form>




 


 
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.IO

 

 


Protected Sub btnGenerate_Click(sender As Object, e As EventArgs)
    Dim barCode As String = txtCode.Text
    Dim imgBarCode As New System.Web.UI.WebControls.Image()
    Using bitMap As New Bitmap(barCode.Length * 40, 80)
        Using graphics__1 As Graphics = Graphics.FromImage(bitMap)
            Dim oFont As New Font("IDAutomationHC39M", 16)
            Dim point As New PointF(2.0F, 2.0F)
            Dim blackBrush As New SolidBrush(Color.Black)
            Dim whiteBrush As New SolidBrush(Color.White)
            graphics__1.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height)
            graphics__1.DrawString("*" & barCode & "*", oFont, blackBrush, point)
        End Using
        Using ms As New MemoryStream()
            bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png)
            Dim byteImage As Byte() = ms.ToArray()
 
            Convert.ToBase64String(byteImage)
            imgBarCode.ImageUrl = "data:image/png;base64," & Convert.ToBase64String(byteImage)
        End Using
        plBarCode.Controls.Add(imgBarCode)
    End Using
End Sub

 

 

 

 

https://www.aspsnippets.com/Articles/Dynamically-Generate-and-Display-Barcode-Image-in-ASPNet.aspx

Tutorials Utils VB Visual Studio

Default certificate could not be created. Publish aborting

You need to tell the Publisher where to get the Certificate from:

  1. Go to Project-> Properties
  2. Go to the tab named “Signing”
  3. Check the Checkbox labeled ‘Sign the ClickOnce manifests’. This enables the section where you can point to a certificate.
  4. Click on the button labeled ‘Select From File…”. In the directory listing, choose a key file (.pfx) and Open.
  5. From the step 3, click the button labeled “More Details…”. This will display the certificate you’ve just selected.
  6. Click “Install Certificate” and follow the prompts.
  7. Save and Publish your Solution.
Code Snippets .NET VB

Get First and last word from sentence

        Dim Nome As String = &quot;Carlos Galhano&quot;
        Dim firstword As String = Nome.Substring(0, Nome.IndexOf(&quot; &quot;))
        Dim lastWord As String = Nome.Substring(Nome.LastIndexOf(&quot; &quot;c) + 1)
        Response.Write(&quot;first: &quot; &amp; firstword &amp; &quot; Last: &quot; &amp; lastWord)