Tags » VB .NET

[VB.NET] Telegram Send and Receive a Document File

In this brief post I show you how to send and receive a file from telegram app, before reading this post You must read this… 272 more words


VB.net code to detect USB arrival and removal

Add reference to System.Management and System.Management.Instrumentation from Projecct >Add Reference Menu.

Imports System.Management
Imports System.IO

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

Const WM_DEVICECHANGE As Integer = &H219
Const DBT_DEVICEARRIVAL As Integer = &H8000


  Select Case m.WParam.ToInt32
      MsgBox("USB Arrived")
      MsgBox("USB Removed")
  End Select
End If
End Sub


solve Update requires a valid UpdateCommand when passed DataRow collection with modified rows

hi there,

so again working on the same project that i talked yesterday in that lookUpEdit to ComboBox post , I had came across another problem, actually there had been many problems but then i was not active on this blog, so i’m only writing about recent problems, ohk so the problem i had is that : i have a DataGrid control ,what i wanted to do is update my Database , if i make changes in the DataGrid. 181 more words


ASP.NET Web API : How to respond to browsers preflight requests in order to bypass CORS (Cross-Origin Resource Sharing) issue

First create a class PreflightRequestsHandler.vb

Imports System.Threading
Imports System.Threading.Tasks
Imports System.Net
Imports System.Net.Http

Namespace RequestHandlers
    Public Class PreflightRequestsHandler
        Inherits DelegatingHandler

        Protected Overrides Function SendAsync(request As HttpRequestMessage, cancellationToken As CancellationToken) As Task(Of HttpResponseMessage)

            If (request.Headers.Contains("Origin") And request.Method.Method.Equals("OPTIONS")) Then
                Dim suppliedOrigin As String() = request.Headers.GetValues("Origin")
                Dim response = New HttpResponseMessage()
                response.StatusCode = HttpStatusCode.OK
                response.Headers.Add("Access-Control-Allow-Origin", suppliedOrigin(0))
                response.Headers.Add("Access-Control-Allow-Headers", "Origin,Content-Type,Accept,Authorization,X-Requested-With")
                response.Headers.Add("Access-Control-Allow-Methods", "GET,POST,HEAD,PUT,PATCH,DELETE,OPTIONS")
                response.Headers.Add("Access-Control-Allow-Credentials", "true")

                Dim tsc = New TaskCompletionSource(Of HttpResponseMessage)()
                Return tsc.Task
            End If

            Return MyBase.SendAsync(request, cancellationToken)
        End Function
    End Class
End Namespace
… 14 more words

Devexpress LookUpEdit to ComboBox edit (16.2 or maybe later)

hello friends ,

one good day i found about DevExpress controls for winforms , and i found it extremely easy to use, it also has more accessibility and functionality . 423 more words


[VB.NET] Convert String Date to Date without using Culture

The normal data conversion depends on system language and/or date format.
you use this brief code if you do not want to manage the culture. 28 more words


Interview questions

  1. Given an array of integers write a function in C# to sum all the numbers that are even (any developer should be able to quickly write this out on a white board or paper, no need for tooling).
  2. 860 more words