Module Module1 ‘ MCTS70-536-1-2 ‘ VB.NET ‘ Demonstration of a structure and an override of the ToString method to display ‘ all parts of our person Public Structure Person ‘ — Example of an enumaration, see the actual Main() Method for use Enum Genders Male Female End Enum Private _firstname As String Private _lastname As […]
Month: February 2020
Installing JQuery in Visual Studio step by step
All the knowledge is out there, but for people new to jQuery it can be a challenge to make a more or less clean integration in Visual Studio. The key components are the nuget package manager and the script manager component, which often are described separately. Keep in mind there are multiple methods to get […]
Getting the current date/time from a NIST server
‘ — Get the current time/date from an internet nist server ‘ more timeserver here: http://tf.nist.gov/service/time-servers.html Dim s_checkserver As String = “time.nist.gov” Dim myreader As StreamReader Dim s_timestring As String Try myreader = New StreamReader(New Net.Sockets.TcpClient(s_checkserver, 13).GetStream) s_timestring = myreader.ReadToEnd s_timestring = Trim(LTrim(s_timestring)) Catch ex As Exception ‘ — unable to contact timeserver End End […]
Demonstration of Extending a class
Module Module1 ‘ MCTS70-536/1/1/3 ‘ Extending an existing class ”’ <summary> ”’ A simple base class ”’ </summary> ”’ <remarks></remarks> Public Class Customer Private _naam As String Private _adres As String Private _woonplaats As String Public Property Naam() As String Get Return _naam End Get Set(ByVal value As String) _naam = value End Set End […]
Demonstration of structures and overriding operators
Module Module1 ‘ MCTS70-536-1-1 ‘ VB.NET ‘ Demonstration of a structure with ‘ an operator (+) ‘ an Override (toString) ‘ Public Structure DemoStruct Private _waarde As Integer ‘ — Read and write initial & current value Public Property Value() As Integer Get Return _waarde End Get Set(ByVal value As Integer) _waarde = value End […]
Demonstration of creating an event handler and attaching to an event
Public Class Form1 ‘ MCTS70-536-1-3 ‘ Registering and handling Events Private t As Timer Private p As ProgressBar Private Sub t_Tick(ByVal sender As Object, ByVal e As EventArgs) p.Value += 1 If p.Value = 100 Then p.Value = 1 End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load […]
Changing the runtime priority of your application
Module Module1 Sub Main() ‘ — Idle time only, the lowest priority. Use with care as your application could get very little cpu ‘ time allocated on a busy system System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.Idle ‘ — Below normal priority System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal ‘ — Default priority, equal to other programms System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.Normal ‘ — High […]
Compressing and decompressing files with GZIPStream or Deflatestream
These samples whow how to compress and decompress files with the build in framework methods. For real world applications consider using something like .netzip from codeplex, since the compression quality from the build in methods is limited. Also, the build in methods will allow you to just compress and decompress a single file. Compressing a […]
Reading screen pixels from the main screen, and specific other application windows
Reading from the full screen This code sample reads the pixel of the screen that the mouse points to, and changes the form’s background color to match that pixel’s color. Note that this code attaches to the main screen, and not to the window of a specific application. If you want to attach to a […]
Making a form transparant
This code sample displays a method to seemingly draw anywhere freely on the screen. The key to this technique is the TransparanceKey offered by the .net framework, which makes this a fairly straightforward task. To make the background of a form transparant, the *only* thing we need to do is this; oDrawform.AllowTransparency = True oDrawform.TransparencyKey […]