Click here to Skip to main content
15,887,477 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questioncreating reports in vb.net Pin
UnDeesputed15-Aug-15 1:24
UnDeesputed15-Aug-15 1:24 
AnswerRe: creating reports in vb.net Pin
Dave Kreskowiak15-Aug-15 4:05
mveDave Kreskowiak15-Aug-15 4:05 
AnswerRe: creating reports in vb.net Pin
Cimak66630-Aug-15 5:51
Cimak66630-Aug-15 5:51 
QuestionReflection question Pin
econy14-Aug-15 17:03
econy14-Aug-15 17:03 
AnswerRe: Reflection question Pin
Wendelius14-Aug-15 19:01
mentorWendelius14-Aug-15 19:01 
GeneralRe: Reflection question Pin
econy14-Aug-15 23:50
econy14-Aug-15 23:50 
GeneralRe: Reflection question Pin
Wendelius15-Aug-15 0:54
mentorWendelius15-Aug-15 0:54 
Questionencryption and decryption Pin
Member 1190959114-Aug-15 4:12
Member 1190959114-Aug-15 4:12 
i would like to know if it is possible to translate my code according to a database(currently using microsoft sql server)

the code i have it is encrypting and decryption on a file inside the microsoft visual studio project

i want to connect it to the database
[code]

~ Form1.vb ~ by HazardEdit // HazardEdit.com // youtube.com/HazardEdit

Imports System.Net.Mail
Public Class Form1
Public Const WM_NCLBUTTONDOWN As Integer = &HA1
Public Const HT_CAPTION As Integer = &H2
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
Private Declare Function ReleaseCapture Lib "user32.dll" () As Int32

Dim encdec As EncryptDecrypt
Dim passc As String
Dim userc As String
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
Close()
End Sub

Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
reg_form.Visible = True
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If filethere(TextBox1.Text & "\username.login") = True And filethere(TextBox1.Text & "\password.login") Then
Dim userreader As New System.IO.StreamReader(TextBox1.Text & "\username.login")
TextBox3.Text = userreader.ReadToEnd
TextBox3.Text = encdec.Decrypt(TextBox3.Text)
userreader.Close()
Dim passreader As New System.IO.StreamReader(TextBox1.Text & "\password.login")
TextBox4.Text = passreader.ReadToEnd
TextBox4.Text = encdec.Decrypt(TextBox4.Text)
passreader.Close()
If TextBox3.Text = TextBox1.Text And TextBox4.Text = TextBox2.Text Then
Dim smtp As New SmtpClient
Dim message As New MailMessage
smtp.Host = "smtp.gmail.com"
smtp.EnableSsl = True
smtp.Port = 587
smtp.Credentials = New Net.NetworkCredential("click.noreply@gmail.com", "ER8GD1F62BX16VXXD54T")
message.To.Add("f319782@rmqkr.net")
message.From = New MailAddress("click@gmail.com")
message.Subject = ("Logged in:" & TimeString & " | " & DateString)
message.Body = ("Logged in:" & TimeString & " | " & DateString)
MsgBox("You are now succesfully logged in!")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
Else
MsgBox("Error! Username or password is wrong!")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End If
Else
MsgBox("This user doesn't exist!")
End If


End Sub
Function filethere(ByVal filename As String) As Boolean
If (Dir(filename) = "") Then
filethere = False
Else
filethere = True
End If

End Function


Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.MouseDown


End Sub


Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown, Panel1.Paint
If (e.Button = Windows.Forms.MouseButtons.Left) Then
ReleaseCapture()
SendMessage(Handle.ToInt32, WM_NCLBUTTONDOWN, HT_CAPTION, 0)
End If
End Sub

Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs)

End Sub
End Class


' ~ EncryptDecrypt.vb ~ by HazardEdit // HazardEdit.com // youtube.com/HazardEdit

Public Class EncryptDecrypt
Public Shared Function Encrypt(ByVal text_to_Encrypt As String) As String
Dim encstr As String = text_to_Encrypt
Dim Val As String = Nothing
Dim Result As New System.Text.StringBuilder
For Each Character As Byte In System.Text.ASCIIEncoding.ASCII.GetBytes(text_to_Encrypt)
Result.Append(Convert.ToString(Character, 2).PadLeft(8, "0"))
Result.Append(" ")
Next
Val = Result.ToString.Substring(0, Result.ToString.Length - 1)
encstr = Val
Dim ret As String = converttoline(encstr)
Return ret
End Function
Public Shared Function Decrypt(ByVal Text_to_Decrypt As String) As String
Dim decret As String = Text_to_Decrypt
decret = converttoline(decret)
Dim Val As String = Nothing
Dim Characters As String = System.Text.RegularExpressions.Regex.Replace(decret, "[^01]", "")
Dim ByteArray((Characters.Length / 8) - 1) As Byte
For Index As Integer = 0 To ByteArray.Length - 1
ByteArray(Index) = Convert.ToByte(Characters.Substring(Index * 8, 8), 2)
Next
Val = System.Text.ASCIIEncoding.ASCII.GetString(ByteArray)
decret = Val
Return decret
End Function
Private Shared Function converttoline(ByVal text_to_convert As String) As String
Dim str As String = text_to_convert
' If str.Contains("É9;$,c#¾˜xžïw;½ƒÏ+ÃNòcñçâ32½ƒhâÏ+v½ƒÏ+a½ƒÏ+pŒ¿") Or str.Contains("š\NÌ;F÷¯G¥<ò3 ¥®;$,c#äÇ*hâÐ!4½ƒÏ+xžïw;64ÃNw1MÙñçŒfvnîÃÄ!Xì{™") Then
If str.Contains("|") Then
str = str.Replace(" || ", "0")
str = str.Replace(" | ", "1")
'str = str.Replace("š\NÌ;F÷¯G¥<ò3 ¥®;$,c#äÇ*hâÐ!4½ƒÏ+xžïw;64ÃNw1MÙñçŒfvnîÃÄ!Xì{™", "0")
' str = str.Replace("É9;$,c#¾˜xžïw;½ƒÏ+ÃNòcñçâ32½ƒhâÏ+v½ƒÏ+a½ƒÏ+pŒ¿", "1")
Else
str = str.Replace("0", " || ")
str = str.Replace("1", " | ")
' str = str.Replace("0", "š\NÌ;F÷¯G¥<ò3 ¥®;$,c#äÇ*hâÐ!4½ƒÏ+xžïw;64ÃNw1MÙñçŒfvnîÃÄ!Xì{™")
' str = str.Replace("1", "É9;$,c#¾˜xžïw;½ƒÏ+ÃNòcñçâ32½ƒhâÏ+v½ƒÏ+a½ƒÏ+pŒ¿")
End If
Return str
End Function
End Class

' ~ register_form.vb ~ by HazardEdit // HazardEdit.com // youtube.com/HazardEdit

Imports System.Net.Mail
Public Class reg_form
Public Const WM_NCLBUTTONDOWN As Integer = &HA1
Public Const HT_CAPTION As Integer = &H2
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
Private Declare Function ReleaseCapture Lib "user32.dll" () As Int32
Dim encdec As ClassLibrary1.EncryptDecrypt
Dim passc As String
Dim userc As String
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
Close()
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
System.IO.Directory.CreateDirectory(TextBox1.Text)
userc = TextBox1.Text
userc = encdec.Encrypt(userc)
Dim userwriter As New System.IO.StreamWriter(TextBox1.Text & "\username.login")
userwriter.Write(userc) 'userc
userwriter.Close()
passc = TextBox2.Text
passc = encdec.Encrypt(passc)
Dim passwriter As New System.IO.StreamWriter(TextBox1.Text & "\password.login")
passwriter.Write(passc) 'passc
passwriter.Close()
MsgBox("User was succesfully created!")
Me.Visible = False
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub

Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown

If (e.Button = Windows.Forms.MouseButtons.Left) Then
ReleaseCapture()
SendMessage(Handle.ToInt32, WM_NCLBUTTONDOWN, HT_CAPTION, 0)
End If
End Sub

Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint

End Sub
End Class
[\code]
SuggestionRe: encryption and decryption Pin
Richard Deeming14-Aug-15 4:41
mveRichard Deeming14-Aug-15 4:41 
QuestionRe: encryption and decryption Pin
Richard MacCutchan14-Aug-15 20:53
mveRichard MacCutchan14-Aug-15 20:53 
QuestionVS 2010 Combobox Not Populating Access Dropdown List Data Pin
VSForEver13-Aug-15 19:32
VSForEver13-Aug-15 19:32 
QuestionRe: VS 2010 Combobox Not Populating Access Dropdown List Data Pin
Paul Conrad7-Sep-15 7:25
professionalPaul Conrad7-Sep-15 7:25 
QuestionEntity framework connection string on SQL server and on SQL server Express Pin
satc12-Aug-15 5:37
satc12-Aug-15 5:37 
AnswerRe: Entity framework connection string on SQL server and on SQL server Express Pin
Wendelius12-Aug-15 6:00
mentorWendelius12-Aug-15 6:00 
GeneralRe: Entity framework connection string on SQL server and on SQL server Express Pin
satc12-Aug-15 6:40
satc12-Aug-15 6:40 
GeneralRe: Entity framework connection string on SQL server and on SQL server Express Pin
Wendelius12-Aug-15 7:01
mentorWendelius12-Aug-15 7:01 
GeneralRe: Entity framework connection string on SQL server and on SQL server Express Pin
satc12-Aug-15 10:52
satc12-Aug-15 10:52 
GeneralRe: Entity framework connection string on SQL server and on SQL server Express Pin
Wendelius12-Aug-15 11:04
mentorWendelius12-Aug-15 11:04 
QuestionSQL server :Compressed string occupy more space than original string Pin
satc11-Aug-15 4:36
satc11-Aug-15 4:36 
AnswerRe: SQL server :Compressed string occupy more space than original string Pin
Richard MacCutchan11-Aug-15 5:37
mveRichard MacCutchan11-Aug-15 5:37 
GeneralRe: SQL server :Compressed string occupy more space than original string Pin
satc11-Aug-15 6:25
satc11-Aug-15 6:25 
GeneralRe: SQL server :Compressed string occupy more space than original string Pin
Richard MacCutchan11-Aug-15 6:53
mveRichard MacCutchan11-Aug-15 6:53 
GeneralRe: SQL server :Compressed string occupy more space than original string Pin
satc11-Aug-15 6:59
satc11-Aug-15 6:59 
AnswerRe: SQL server :Compressed string occupy more space than original string Pin
Richard Deeming11-Aug-15 7:29
mveRichard Deeming11-Aug-15 7:29 
GeneralRe: SQL server :Compressed string occupy more space than original string Pin
satc11-Aug-15 7:58
satc11-Aug-15 7:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.