Monday, December 9, 2019
Saturday, July 27, 2019
Try in Future
Excell Show = https://www.youtube.com/watch?v=ssvq9nji5Y8&t=32s
ublic Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try Dim MyConnection As System.Data.OleDb.OleDbConnection Dim dataSet As System.Data.DataSet Dim MyCommand As System.Data.OleDb.OleDbDataAdapter Dim path As String = "C:\\Users\\dwishika\\Desktop\\vids\\excel\\Book1.xlsx" MyConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;") MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection) dataSet = New System.Data.DataSet MyCommand.Fill(dataSet) DataGridView1.DataSource = dataSet.Tables(0) MyConnection.Close() Catch ex As Exception MsgBox(ex.Message.ToString) End Try End Sub End Class
excell import
https://www.youtube.com/watch?v=gAgoQwYV5Sk
Imports System.Linq Imports System.Data.SqlClient Imports System.Data.OleDb Imports Microsoft.Office.Core Imports Excel = Microsoft.Office.Interop.Excel Imports ExcelAutoFormat = Microsoft.Office.Interop.Excel.XlRangeAutoFormat Imports Microsoft.Office.Interop Imports System.IO Imports System.Xml.XPath Imports System.Data Imports System.Xml Public Class Todays_record Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim xlApp As Microsoft.Office.Interop.Excel.Application Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet Dim misValue As Object = System.Reflection.Missing.Value Dim i As Integer Dim j As Integer xlApp = New Microsoft.Office.Interop.Excel.ApplicationClass xlWorkBook = xlApp.Workbooks.Add(misValue) xlWorkSheet = xlWorkBook.Sheets("sheet1") For i = 0 To DataGridView1.RowCount - 2 For j = 0 To DataGridView1.ColumnCount - 1 For k As Integer = 1 To DataGridView1.Columns.Count xlWorkSheet.Cells(1, k) = DataGridView1.Columns(k - 1).HeaderText xlWorkSheet.Cells(i + 2, j + 1) = DataGridView1(j, i).Value.ToString() Next Next Next xlWorkSheet.SaveAs("D:\Todays_record_excel.xlsx") xlWorkBook.Close() xlApp.Quit() releaseObject(xlApp) releaseObject(xlWorkBook) releaseObject(xlWorkSheet) MsgBox("You can find the file D:\Todays_record_excel.xlsx") End Sub Private Sub releaseObject(ByVal obj As Object) Try System.Runtime.InteropServices.Marshal.ReleaseComObject(obj) obj = Nothing Catch ex As Exception obj = Nothing Finally GC.Collect() End Try End Sub End Class
Friday, July 26, 2019
Mdi & Sdi form
IsMdiContainer =True
Me.MdiParent = MainDashboard
Private Sub MainDashboard_Load(sender As Object, e As EventArgs) Handles MyBase.Load
IsMdiContainer = True
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.MdiParent = MainDashboard
End Sub
Single Document interface = sdi = Child Form
Multiple Document interface = mdi = parrent Form
Me.MdiParent = MainDashboard
Private Sub MainDashboard_Load(sender As Object, e As EventArgs) Handles MyBase.Load
IsMdiContainer = True
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.MdiParent = MainDashboard
End Sub
Single Document interface = sdi = Child Form
Multiple Document interface = mdi = parrent Form
Thursday, July 25, 2019
How Many Data Save in Table
Dim Count As Integer
Count = Table1BindingSource.Count
Label1.Text = Count.ToString + "-" + "Shop"
ACCESS DATA TABLE FILE SAVE
Try
Table1BindingSource.EndEdit()
Table1TableAdapter.Update(DatabaseCustomerShebaDataSet.Table1)
MsgBox("Save data")
Catch ex As Exception
MsgBox("Please fill everything or reedit")
End Try
Tuesday, July 16, 2019
Calculator
Dims
******
Dim Firstnum As Decimal
Dim secondnum As Decimal
Dim Operations As Integer
Dim Operator_selctor As Boolean = False
****************************************************************************************************************************************************
Num 1
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "1"
Else
TextBox1.Text = "1"
End If
End Sub
****************************************************************************************************************************************************
Num 2
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "2"
Else
TextBox1.Text = "2"
End If
End Sub
****************************************************************************************************************************************************
Num 3
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "3"
Else
TextBox1.Text = "3"
End If
End Sub
****************************************************************************************************************************************************
Num 4
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "4"
Else
TextBox1.Text = "4"
End If
End Sub
****************************************************************************************************************************************************
Num 5
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "5"
Else
TextBox1.Text = "5"
End If
End Sub
****************************************************************************************************************************************************
Num 6
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "6"
Else
TextBox1.Text = "6"
End If
End Sub
****************************************************************************************************************************************************
Num 7
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "7"
Else
TextBox1.Text = "7"
End If
End Sub
****************************************************************************************************************************************************
Num 8
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "8"
Else
TextBox1.Text = "8"
End If
End Sub
****************************************************************************************************************************************************
Num 9
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "9"
Else
TextBox1.Text = "9"
End If
End Sub
****************************************************************************************************************************************************
Num 0
*******
If TextBox1.Text <> "0" Then
TextBox1.Text += "0"
End If
End Sub
****************************************************************************************************************************************************
Clear Button
**************
TextBox1.Text = "0"
End Sub
****************************************************************************************************************************************************
(.) Button
***********
If Not (TextBox1.Text.Contains(".")) Then
TextBox1.Text += "."
End If
End Sub
****************************************************************************************************************************************************
(+) Button
***********
Firstnum = TextBox1.Text
TextBox1.Text = "0"
Operator_selctor = True
Operations = 1 ' = +
End Sub
****************************************************************************************************************************************************
(-) Button
**********
Firstnum = TextBox1.Text
TextBox1.Text = "0"
Operator_selctor = True
Operations = 2 ' - -
End Sub
****************************************************************************************************************************************************
(x) Button
***********
Firstnum = TextBox1.Text
TextBox1.Text = "0"
Operator_selctor = True
Operations = 3 '=x
End Sub
****************************************************************************************************************************************************
(/) Button
**********
Firstnum = TextBox1.Text
TextBox1.Text = "0"
Operator_selctor = True
Operations = 4 ' /
End Sub
****************************************************************************************************************************************************
(=) Button
***********
If Operator_selctor = True Then
secondnum = TextBox1.Text
If Operations = 1 Then
TextBox1.Text = Firstnum + secondnum
ElseIf Operations = 2 Then
TextBox1.Text = Firstnum - secondnum
ElseIf Operations = 3 Then
TextBox1.Text = Firstnum * secondnum
Else
If secondnum = 0 Then
TextBox1.Text = "Error!"
Else
TextBox1.Text = Firstnum / secondnum
End If
End If
Operator_selctor = False
End If
End Sub
End Class
****************************************************************************************************************************************************
Web browser
back Button = WebBrowser1.GoBack
Forword Button = WebBrowser1.GoForword
Refresh Button = WebBrowser1.Refresh
Home button = WebBrowser1.Navigate("#")
Go Button = WebBrowser1.Navigate("Textboox.Text")
Google Search = WebBrowser1.Navigate("https://www.google.com/search?q=" + TextBox1.Text)
Show Windows Time
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Label1.Text = TimeOfDay
End Sub
Friday, July 12, 2019
Button Background and text color & Form background and textchange
Button1.ForeColor = Color.White text color
Button1.BackColor = Color.Blue
Me.ForeColor = Color.White form color
Me.BackColor = Color.Red
TableLayoutPanel Show and Hide
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TableLayoutPanel1.Show()
TableLayoutPanel2.Hide()
TableLayoutPanel3.Hide()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TableLayoutPanel2.Show()
TableLayoutPanel3.Hide()
TableLayoutPanel1.Hide()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
TableLayoutPanel3.Show()
TableLayoutPanel2.Hide()
TableLayoutPanel1.Hide()
End Sub
Font + Color Dialog
Private Sub FontToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FontToolStripMenuItem.Click
FontDialog1.ShowDialog()
RichTextBox1.Font = FontDialog1.Font
End Sub
Private Sub ColorToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ColorToolStripMenuItem.Click
ColorDialog1.ShowDialog()
RichTextBox1.ForeColor = ColorDialog1.Color
End Sub
Print & Preview visual studio
Two button + PrintDocument1 + PrintPreviewDialog1 + RichTextBox1
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If RichTextBox1.Text = "" Then
MsgBox("Your Text is blank. please type something")
Else
PrintPreviewDialog1.ShowDialog()
End If
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
PrintDocument1.Print()
End Sub
Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim font As New Font("Arial", 16, FontStyle.Regular)
e.Graphics.DrawString(RichTextBox1.Text, font, Brushes.Black, 100, 100)
End Sub
Thursday, July 11, 2019
Access file to view
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles ButtonClose.Click
AdminLoginForm.Show()
Me.Hide()
End Sub
Private Sub FontToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FontToolStripMenuItem.Click
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles ButtonNew.Click
TblAdmissionBindingSource.AddNew()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles ButtonSave.Click
TblAdmissionBindingSource.EndEdit()
TblAdmissionTableAdapter.Update(SchoolProjectDataSet.tblAdmission)
End Sub
Private Sub SearchToolStripButton_Click(sender As Object, e As EventArgs) Handles SearchToolStripButton.Click
Try
Me.TblAdmissionTableAdapter.Search(Me.SchoolProjectDataSet.tblAdmission, StudentNameToolStripTextBox.Text)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles ButtonSearch.Click
TblAdmissionTableAdapter.Search(SchoolProjectDataSet.tblAdmission, AdmissionNoTextBox.Text)
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles ButtonRemove.Click
TblAdmissionBindingSource.RemoveCurrent()
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles ButtonPreviews.Click
TblAdmissionBindingSource.MovePrevious()
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles ButtonNext.Click
TblAdmissionBindingSource.MoveNext()
End Sub
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles ButtonFirst.Click
TblAdmissionBindingSource.MoveFirst()
End Sub
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles ButtonLast.Click
TblAdmissionBindingSource.MoveLast()
End Sub
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
FindStudentPayment.Show()
End Sub
End Class
AdminLoginForm.Show()
Me.Hide()
End Sub
Private Sub FontToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FontToolStripMenuItem.Click
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles ButtonNew.Click
TblAdmissionBindingSource.AddNew()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles ButtonSave.Click
TblAdmissionBindingSource.EndEdit()
TblAdmissionTableAdapter.Update(SchoolProjectDataSet.tblAdmission)
End Sub
Private Sub SearchToolStripButton_Click(sender As Object, e As EventArgs) Handles SearchToolStripButton.Click
Try
Me.TblAdmissionTableAdapter.Search(Me.SchoolProjectDataSet.tblAdmission, StudentNameToolStripTextBox.Text)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles ButtonSearch.Click
TblAdmissionTableAdapter.Search(SchoolProjectDataSet.tblAdmission, AdmissionNoTextBox.Text)
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles ButtonRemove.Click
TblAdmissionBindingSource.RemoveCurrent()
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles ButtonPreviews.Click
TblAdmissionBindingSource.MovePrevious()
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles ButtonNext.Click
TblAdmissionBindingSource.MoveNext()
End Sub
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles ButtonFirst.Click
TblAdmissionBindingSource.MoveFirst()
End Sub
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles ButtonLast.Click
TblAdmissionBindingSource.MoveLast()
End Sub
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
FindStudentPayment.Show()
End Sub
End Class
Wednesday, July 10, 2019
Search button by quary
New Quary Name set "Search"
Query Builder Click
(StudentName LIKE?+"%")
Button Coding = ShopdataTableAdapter.Search(ShopmaintaindataDataSet.shopdata, TextBox1.Text)
Query Builder Click
(StudentName LIKE?+"%")
Button Coding = ShopdataTableAdapter.Search(ShopmaintaindataDataSet.shopdata, TextBox1.Text)
save text of text box
public class Forn1
Public sub button_click(fxdhmgickgm,354120)
If (TextBox_pass.Text = "123456") Then
Form2.Show()
Me.Hide()
Else
MessageBox.Shoe("Possword is not Correct")
End If
End Sub
End Class
exit button = Application.Exit()
if (te
SaveFileDialog1.ShowDialog()
SaveFileDialog1.Title = "Save Text"
SaveFileDialog1.InitialDirectory ="C:\"
Dim location As String
location = SaveFileDialog1.FileName
My.Computer.FileSystem.WriteAllText(location & ".txt", "" & TextBox.Text, True) / SaveFileDialog1.Filter = "Text files | *.txt"
SaveFileDialog1.ShowDialog()
RichTextBox1.SaveFile(SaveFileDialog1.FileName)
MsgBox("File save Sucessfuliy")
TextBox5.AppendText (" " + vbNewLine)
TextBox5.AppendText (vbTab & label1.Text + " : " + TextBox1.Text + vbNewLine)
TextBox5.AppendText (" " + vbNewLine)
TextBox5.AppendText (vbTab & label2.Text + " : " + TextBox2.Text + vbNewLine)
TextBox5.AppendText (" " + vbNewLine)
TextBox5.AppendText (vbTab & label3.Text + " : " + TextBox3.Text + vbNewLine)
TextBox5.AppendText (" " + vbNewLine)
TextBox5.AppendText (vbTab & label4.Text + " : " + TextBox4.Text + vbNewLine)
TextBox5.AppendText (" " + vbNewLine)
TextBox5.AppendText (vbTab & Today & TimeOfDay + vbNewLine)
gggggggggggggggggggggggggggggggggggggggggg
If FontDialog1.ShowDialog = DialogResult.Ok Than
TextBox5.Font = FontDialog1.Font
End If
22222222222222222
If ColoDialog1.ShowDialog = Windows.Forms.DialogResult.Ok Than
TextBox5.ForeColor = ColorDialog1.Font
ColorDialog1.ShowDialog()
TextBox5.ForeColor = ColoDialog1.ColorDialog1
Public sub button_click(fxdhmgickgm,354120)
If (TextBox_pass.Text = "123456") Then
Form2.Show()
Me.Hide()
Else
MessageBox.Shoe("Possword is not Correct")
End If
End Sub
End Class
exit button = Application.Exit()
if (te
SaveFileDialog1.ShowDialog()
SaveFileDialog1.Title = "Save Text"
SaveFileDialog1.InitialDirectory ="C:\"
Dim location As String
location = SaveFileDialog1.FileName
My.Computer.FileSystem.WriteAllText(location & ".txt", "" & TextBox.Text, True) / SaveFileDialog1.Filter = "Text files | *.txt"
SaveFileDialog1.ShowDialog()
RichTextBox1.SaveFile(SaveFileDialog1.FileName)
MsgBox("File save Sucessfuliy")
TextBox5.AppendText (" " + vbNewLine)
TextBox5.AppendText (vbTab & label1.Text + " : " + TextBox1.Text + vbNewLine)
TextBox5.AppendText (" " + vbNewLine)
TextBox5.AppendText (vbTab & label2.Text + " : " + TextBox2.Text + vbNewLine)
TextBox5.AppendText (" " + vbNewLine)
TextBox5.AppendText (vbTab & label3.Text + " : " + TextBox3.Text + vbNewLine)
TextBox5.AppendText (" " + vbNewLine)
TextBox5.AppendText (vbTab & label4.Text + " : " + TextBox4.Text + vbNewLine)
TextBox5.AppendText (" " + vbNewLine)
TextBox5.AppendText (vbTab & Today & TimeOfDay + vbNewLine)
gggggggggggggggggggggggggggggggggggggggggg
If FontDialog1.ShowDialog = DialogResult.Ok Than
TextBox5.Font = FontDialog1.Font
End If
22222222222222222
If ColoDialog1.ShowDialog = Windows.Forms.DialogResult.Ok Than
TextBox5.ForeColor = ColorDialog1.Font
ColorDialog1.ShowDialog()
TextBox5.ForeColor = ColoDialog1.ColorDialog1
Monday, June 24, 2019
Login and open second form with message
video will be here
If UsernameTextBox.Text = "SHEBA" And PasswordTextBox.Text = "COMPUTER" Then
MsgBox("Sucessful login")
AdminPanel.Show()
Me.Hide()
Else
MsgBox("PLEASE TYPE CORRECT ID AND PASSWORD")
End If
Login and open second form with message |
If TextBox1.Text = "SHEBA" And TextBox2.Text = "COMPUTER" Then
MsgBox("Sucessful login") Form2.Show() Me.Hide() Else MsgBox("PLEASE TYPE CORRECT ID AND PASSWORD") |
Design mode |
Form1 + Form2 |
TextBox1 + TextBox1 + Button1 |