Programming for Everybody: 2019

Retrieve data by timer VB.net - Example: essential English words- First Time



Imports System.Data.OleDb
Imports System.IO
Imports System.Configuration
Imports System.Data
Imports System.Data.DataTable
Public Class Form1
    Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\english1.mdb")
    Dim myreader11 As OleDbDataReader
    Dim myreader5 As OleDbDataReader


    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

    End Sub

    Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        If conn.State = ConnectionState.Closed Then
            conn.Open()
        End If


        Dim myreader1 As OleDbDataReader



        Dim strsql As String
        strsql = "select id from table1 where id =(select max(id) from table1)"
        Dim cmd1 As New OleDbCommand(strsql, conn)

        myreader1 = cmd1.ExecuteReader
        myreader1.Read()
        Label2.Text = myreader1("id")

        Timer2.Enabled = True


        conn.Close()


    End Sub

    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        For aa As Integer = 0 To TextBox1.Text Step 1
            aa = TextBox1.Text + 1
            TextBox1.Text = aa



            Dim strsql As String
            strsql = "select id from table1 where id=" + TextBox1.Text + ""
            Dim cmd1 As New OleDbCommand(strsql, conn)
            If conn.State = ConnectionState.Closed Then
                conn.Open()
            End If

            myreader11 = cmd1.ExecuteReader



            If (myreader11.Read()) Or aa < Label2.Text Then

                'Try

                '    TextBox1.Text = myreader1("id")
                'Catch


                'End Try
                load1()


            Else
                Timer2.Enabled = False

                TextBox1.Text = Label2.Text


                MessageBox.Show("Words Ended")

                Return


            End If





        Next
        conn.Close()


    End Sub
    Private Sub load1()
        Try
            Dim conn5 As New OleDbConnection

            conn5.ConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\english1.mdb")
            If conn5.State = ConnectionState.Closed Then
                conn5.Open()
            End If
            Dim strsql5 As String
            strsql5 = "select * from table1 where id=" + TextBox1.Text + ""
            Dim cmd5 As New OleDbCommand(strsql5, conn5)
            myreader5 = cmd5.ExecuteReader

            myreader5.Read()

            Try
                Label3.Text = myreader5("word")
            Catch
            End Try
            Try


                Label4.Text = myreader5("ar")
            Catch
            End Try

            Try


                Label5.Text = myreader5("en")
            Catch
            End Try



            conn5.Close()
        Catch
        End Try
    End Sub


End Class

Source code : Move picture like space ship VB.net

Public Class Form2
    Private slides As Integer
    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        slides += 10
        If slides <= 20 Then
            PictureBox1.Left += 10
        ElseIf slides > 20 AndAlso slides <= 40 Then
            PictureBox1.Top += 10
        ElseIf slides > 40 AndAlso slides <= 60 Then
            PictureBox1.Left -= 10
        ElseIf slides > 60 AndAlso slides <= 80 Then
            PictureBox1.Top -= 10
        Else
            slides = 0
        End If

    End Sub
End Class


insert update delete data in datagridview without using database in visual basic.net




Imports System.Data.DataTable
Public Class Form2
    Dim table As New DataTable("table")
    Dim index As Integer





    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        table.Columns.Add("ID", Type.GetType("System.Int32"))

        table.Columns.Add("First name", Type.GetType("System.String"))

        table.Columns.Add("Last name", Type.GetType("System.String"))

        table.Columns.Add("Sum", Type.GetType("System.Int32"))


        DataGridView1.DataSource = table







    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        table.Rows.Add(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text)

        DataGridView1.DataSource = table




    End Sub

   

  

   

    
    Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick

        index = e.RowIndex

        Dim selectedrow As DataGridViewRow


        selectedrow = DataGridView1.Rows(index)



        TextBox1.Text = selectedrow.Cells(0).Value.ToString


        TextBox2.Text = selectedrow.Cells(1).Value.ToString


        TextBox3.Text = selectedrow.Cells(2).Value.ToString



        TextBox4.Text = selectedrow.Cells(3).Value.ToString














    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Dim newdata As DataGridViewRow


        newdata = DataGridView1.Rows(index)


        newdata.Cells(0).Value = TextBox1.Text

        newdata.Cells(1).Value = TextBox2.Text


        newdata.Cells(2).Value = TextBox3.Text



        newdata.Cells(3).Value = TextBox4.Text
















    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Text = ""


        TextBox2.Text = ""



        TextBox3.Text = ""



        TextBox4.Text = ""







    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        DataGridView1.Rows.RemoveAt(index)








    End Sub
End Class

Programming in Visual Basic .Net How to Connect SQL server

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Database2DataSet.Table1' table. You can move, or remove it, as needed.
        Me.Table1TableAdapter.Fill(Me.Database2DataSet.Table1)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Table1BindingSource.MovePrevious()

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Table1BindingSource.AddNew()

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Table1BindingSource.MoveNext()

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Table1BindingSource.EndEdit()
        Table1TableAdapter.Update(Database2DataSet)
        MessageBox.Show("Data Saved")
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Table1BindingSource.RemoveCurrent()

    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Me.Close()

    End Sub
End Class

Update insert and delete gridview without database asp.net (vb.net)

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    Name    <asp:TextBox ID="TxtName" runat="server" ></asp:TextBox>
       Age<asp:TextBox ID="txtAge" runat="server" ></asp:TextBox>
        <asp:Button ID="btnInsert" Text="Save"  runat="server" OnClick="btnInsert_Click"  />
      <%--  <asp:Button ID="btnUpdate" Text="Update" runat="server" OnClick="btnUpdate_Click" />--%>
    <asp:GridView ID="grdView" runat="server" OnRowCommand="grdView_RowCommand" OnRowDeleting="grdView_RowDeleting"
>
        <Columns>
            <asp:TemplateField>

                <ItemTemplate>
                    <asp:Button ID="btn" runat="server" Text="Delete"  CommandName="delete" CommandArgument='<%# Container.DataItemIndex %>' />
            </ItemTemplate>

         <%--   <ItemTemplate>
                <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="Edit" />
            </ItemTemplate>--%>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Button runat="server" CommandName="Change" ID="btnEdit" Text="Edit" CommandArgument='<%# Container.DataItemIndex %>'  />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>

        </asp:TemplateField>
    </Columns>
</asp:GridView>
</div>
    </form>
</body>
</html>

ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
Imports System.Data.OleDb
Imports System.IO
Imports System.Configuration
Imports System.Data
Imports System.Data.DataTable
Partial Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    End Sub

    Public Shared dt As Datatable
    Public Shared i As Integer = 1

    Protected Sub btnInsert_Click(ByVal sender As Object, ByVal e As EventArgs)
        If Convert.ToString(ViewState("Row")) <> "" Then
            dt.Rows(Convert.ToInt32(ViewState("Row")))("Column1") = TxtName.Text
            dt.Rows(Convert.ToInt32(ViewState("Row")))("Column2") = txtAge.Text
            grdView.DataSource = dt
            grdView.DataBind()
            ViewState("Row") = ""
        ElseIf Convert.ToString(ViewState("Row")) = "" Then
            Session("datatable") = dt
            dt = New DataTable()
            Dim dr As DataRow = Nothing
            dt.Columns.Add(New DataColumn("RowNumber", GetType(Integer)))
            dt.Columns.Add(New DataColumn("Column1", GetType(String)))
            dt.Columns.Add(New DataColumn("Column2", GetType(String)))

            If Session("datatable") IsNot Nothing Then
                dt = CType(Session("datatable"), DataTable)
                dr = dt.NewRow()
                dr("RowNumber") = i
                dr("Column1") = TxtName.Text
                dr("Column2") = txtAge.Text
                dt.Rows.Add(dr)
            Else
                dr = dt.NewRow()
                dr("RowNumber") = i
                dr("Column1") = TxtName.Text
                dr("Column2") = txtAge.Text
                dt.Rows.Add(dr)
            End If

            grdView.DataSource = dt
            grdView.DataBind()
            i += 1
        End If
    End Sub

    Protected Sub grdView_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)
        If e.CommandName = "delete" Then
            dt = CType(Session("datatable"), DataTable)

            If dt.Rows.Count >= 0 Then
                dt.Rows.RemoveAt(Convert.ToInt16(e.CommandArgument))
                grdView.DataSource = dt
                grdView.DataBind()
            End If
        ElseIf e.CommandName = "Change" Then
            dt = CType(Session("datatable"), DataTable)
            TxtName.Text = grdView.Rows(Convert.ToInt32(e.CommandArgument)).Cells(4).Text
            txtAge.Text = grdView.Rows(Convert.ToInt32(e.CommandArgument)).Cells(5).Text
            ViewState("Row") = e.CommandArgument

            If dt.Rows.Count >= 0 Then
                grdView.DataSource = dt
                grdView.DataBind()
            End If
        End If
    End Sub

    Protected Sub grdView_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs)
        grdView.DataSource = dt
        grdView.DataBind()
    End Sub

    Protected Sub grdView_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
        TxtName.Text = grdView.SelectedRow.Cells(2).Text
    End Sub
End Class


تحميل برنامج صغير لتسجيل اصناف في قاعدة بيانات SQl server وعرضها في combobox مع امكانية الاضافة والحذف والتعديل vb.net

نموذج بسيط  لتسجيل أصناف وعرضها في أداة Combobox مع عدام تكرار الاصناف مع امكانية  الحذف وكذلك تم اضافة قاعدة البيانات (SQl Server (products.


تحميل

برنامج مراجعة جميع كلمات اللغة الانجليزية لمرحلة الحضانة والصف الأول الابتدائي

برنامج لتعليم أطفالك اللغة الانجليزية في مرحلة الحضانة 



تم تصميم برنامج لعرض جميع كلمات اللغة الانجليزية بالصوت والصورة للأطفال ويشمل (الحروف وأصواتها بالترتيب -الكلمات مرتبة تبعا للحروف الأبجدية - الأفعال - الألوان مع صورة لكل لون مرتبطة بالكلمة - الأرقام - أجزاء الجسم - العائلة ) وغيرها من المميزات بالبرنامج
 رابط تحميل البرنامج 

  https://www.mediafire.com/file/un5d4ne1z3dvza4/ABC4.rar/file