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
****************************************************************************************************************************************************