VB.NET Code Snippets: Math, Logic, and Number Operations
VB.NET Code Snippets
Factorial Calculation
VB.NET code to calculate the factorial of a number:
Public Class Form1
Dim no As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
no = 1
For x = 1 To Val(TextBox1.Text)
no = no * x
Next
TextBox2.Text = no
End Sub
End Class
Totalizer Counter
VB.NET code for a totalizer counter:
Public Class Form1
Dim c As Integer
Dim t As Integer
Private Sub Button1_Click(ByVal sender As System.Object,
Read More
Oracle Database LOB Data Handling with C# and VB.NET
Oracle LOB Data Handling
BFILE Image
This section demonstrates how to handle BFILE data in Oracle using C#.
CREATE TABLE bfile_tab(
dogID NUMBER NOT NULL PRIMARY KEY,
dog_img BFILE
);
INSERT INTO bfile_tab VALUES(10, BFILENAME('DOG', '2.jpg'));
INSERT INTO bfile_tab VALUES(20, BFILENAME('DOG', '3.jpg'));
COMMIT;
C# Code
using System;
using System.IO;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace DOG
{
public partial class Form1 :
Read More
Financial Calculations: Interest, Loans, and Discount Analysis
Inc: TAE?, J12 = 4%; K=12; TAE=(1+Jk /K) ^K-1, Inc: It ?; Co=1200; J2 =4.2%; K=2; n=10; TAE=(1+Jk /K)^k-1; It =Co*(1+i)^n-1 Inc: TAE?; J2J3J4J12=6.13%; TAE=(1+Jk/K)^k-1, Inc: TAE?, J12=1.95%; K=12; TAE= (1+Jk/K)^K-1 Inc: Co?; n=3; J6=3.85%; K=6 ; Cn=17223.01; ik=Jk/k; TAE=(1+ik)^k-1; Co=Cn/(1+TAE)^n; Inc: Cn?; Co=3500; i=7.5%; n=2; n1=i12; n2=i4; ik=(1+i)^1/k-1; Cn=Co*(1+ik)^k; Inc: It ?; Co=450; J12=3% ; K=12; n=4 ;TAE=(1+Jk/k)^k-1; It=Co*(1+TAE)^n-1; Inc: TAE?; J4=5.5%; k=4; TAE(fórmula); Inc:
Read MoreVB.NET Code Snippets: Number, String, and Palindrome Checks
VB.NET Code Snippets
Here are several VB.NET code snippets demonstrating various functionalities:
4) Parity Check Function
Private Function paroimpar(ByVal x As Integer) As Integer
Dim y As Integer
y = Val(TextBox1.Text)
If y Mod 2 = 0 Then
If y = 0 Then
MsgBox("es NeUtrO")
Exit Function
End If
MsgBox("es par")
Else
If y = 0 Then
MsgBox("es NeUtrO")
End If
MsgBox("es impar")
End If
End Function