Process Modules Project

Process Modules Project source code and complete project in "Process Modules and ProcessName Collecter" e-learning section.
Coded by: Wesam Naffaa

Puzzle Game project

Full Puzzle Game source code and complete project in "Puzzle Game project" e-learning section.
NOTE: You must read "Puzzle Game - Resources" to understand how to apply the sources & codes to your side.
Coded by: Wesam Naffaa

Accounting Manager project

Full Accounting manager source code and complete project in "Universal Accounting Manager project" e-learning section.
NOTE: You must read "Universal Accounting Manager - Resources" to understand how to apply the sources & codes to your side.
Coded by: Wesam Naffaa

File encryption project

Full File encryption center source code and complete project in "File encryption center project" e-learning section.
NOTE: You must read "File encryption center - Resources" to understand how to apply the sources & codes to your side.
Coded by: Wesam Naffaa

Universal Accounting Manager - NewProduct.vb

NewProduct.vb
  1. Public Class NewProduct
  2.     Dim ProgramName As String = My.Application.Info.AssemblyName
  3.     Dim DataPath As String = System.Environment.CurrentDirectory & "\UAM"
  4.     Dim ProductPath As String = DataPath & "\Products" '
  5.     Dim ServicesPath As String = DataPath & "\Services"
  6.     Dim CatPath As String = DataPath & "\Categories"
  7.     Dim StoresPath As String = DataPath & "\Stores"
  8.     Dim AlertsPath As String = DataPath & "\Alerts"
  9.     Dim StoreNumber As Integer = 0
  10.     Dim CalledFrom As String = ""
  11.     Dim LastPriceInformation() As Double = {0, 0, 0}
  12.     Private Shared NewProductInstance As NewProduct
  13.     Public Shared Function GetInstance() As NewProduct
  14.         If (NewProductInstance Is Nothing) Then
  15.             NewProductInstance = New NewProduct
  16.         End If
  17.         Return NewProductInstance
  18.     End Function
  19.     Public Sub CalledFromWindow(ByVal SName As String, ByVal Pname As String)
  20.         CalledFrom = SName
  21.         ProductNameTXT.Text = Pname
  22.         ProductMountTXT.Text = 0
  23.         ProductMountTXT.Enabled = False
  24.     End Sub
  25.     Public Sub AddNewProduct()
  26.         Dim NewProductPath As String = ProductPath & "\" & ProductNameTXT.Text
  27.         If My.Computer.FileSystem.DirectoryExists(NewProductPath) = False Then My.Computer.FileSystem.CreateDirectory(NewProductPath)
  28.         My.Computer.FileSystem.WriteAllText(NewProductPath & "\cat.dat", ProductCatTXT.Text, False)
  29.         If My.Computer.FileSystem.FileExists(CatPath & "\" & ProductCatTXT.Text & ".dat") = True Then
  30.             If ProductAddBTN.Text = "إضافة" Then
  31.                 My.Computer.FileSystem.WriteAllText(CatPath & "\" & ProductCatTXT.Text & ".dat", ProductNameTXT.Text & System.Environment.NewLine, True)
  32.             End If
  33.         Else
  34.             My.Computer.FileSystem.WriteAllText(CatPath & "\" & ProductCatTXT.Text & ".dat", ProductNameTXT.Text & System.Environment.NewLine, False)
  35.         End If
  36.         My.Computer.FileSystem.WriteAllText(NewProductPath & "\type.dat", ProductTypeTXT.Text, False)
  37.         My.Computer.FileSystem.WriteAllText(NewProductPath & "\barcode.dat", ProductCodeTXT.Text, False)
  38.         My.Computer.FileSystem.WriteAllText(NewProductPath & "\price.dat", ProductPriceTXT.Text, False)
  39.         My.Computer.FileSystem.WriteAllText(NewProductPath & "\maintax.dat", ProductTax1TXT.Text, False)
  40.         My.Computer.FileSystem.WriteAllText(NewProductPath & "\subtax.dat", ProductTax2TXT.Text, False)
  41.         My.Computer.FileSystem.WriteAllText(NewProductPath & "\purch.dat", ProductPurchTXT.Text, False)
  42.         My.Computer.FileSystem.WriteAllText(NewProductPath & "\store.dat", ProductStoreTXT.Text, False)
  43.         If My.Computer.FileSystem.DirectoryExists(StoresPath & "\" & ProductStoreTXT.Text) = False Then
  44.             My.Computer.FileSystem.CreateDirectory(StoresPath & "\" & ProductStoreTXT.Text)
  45.             My.Computer.FileSystem.WriteAllText(StoresPath & "\" & ProductStoreTXT.Text & "\" & ProductNameTXT.Text & ".dat", ProductMountTXT.Text, False)
  46.         Else
  47.             If My.Computer.FileSystem.FileExists(StoresPath & "\" & ProductStoreTXT.Text & "\" & ProductNameTXT.Text & ".dat") = True Then
  48.                 Dim LastMount As Double = Val(My.Computer.FileSystem.ReadAllText(StoresPath & "\" & ProductStoreTXT.Text & "\" & ProductNameTXT.Text & ".dat", System.Text.Encoding.GetEncoding(0)))
  49.                 LastMount += Val(ProductMountTXT.Text)
  50.             Else
  51.                 My.Computer.FileSystem.WriteAllText(StoresPath & "\" & ProductStoreTXT.Text & "\" & ProductNameTXT.Text & ".dat", ProductMountTXT.Text, False)
  52.             End If
  53.         End If
  54.         My.Computer.FileSystem.WriteAllText(NewProductPath & "\mount.dat", ProductMountTXT.Text, False)
  55.         My.Computer.FileSystem.WriteAllText(NewProductPath & "\unit.dat", ProductUnitsTXT.Text, False)
  56.         'Add New Stores To Files
  57.         '"NewStoreTXT" & StoreNumber
  58.         Dim VAddad As Integer = 0
  59.         For VAddad = 0 To StoreNumber - 1
  60.             My.Computer.FileSystem.WriteAllText(NewProductPath & "\store" & VAddad & ".dat", Me.Controls.Item("NewStoreTXT" & VAddad).Text, False)
  61.             If My.Computer.FileSystem.DirectoryExists(StoresPath & "\" & Me.Controls.Item("NewStoreTXT" & VAddad).Text) = False Then
  62.                 My.Computer.FileSystem.CreateDirectory(StoresPath & "\" & Me.Controls.Item("NewStoreTXT" & VAddad).Text)
  63.                 My.Computer.FileSystem.WriteAllText(StoresPath & "\" & Me.Controls.Item("NewStoreTXT" & VAddad).Text & "\" & ProductNameTXT.Text & ".dat", Me.Controls.Item("NewMountTXT" & VAddad).Text, False)
  64.             Else
  65.                 If My.Computer.FileSystem.FileExists(StoresPath & "\" & Me.Controls.Item("NewStoreTXT" & VAddad).Text & "\" & ProductNameTXT.Text & ".dat") = True Then
  66.                     Dim LastMount As Double = Val(My.Computer.FileSystem.ReadAllText(StoresPath & "\" & Me.Controls.Item("NewStoreTXT" & VAddad).Text & "\" & ProductNameTXT.Text & ".dat", System.Text.Encoding.GetEncoding(0)))
  67.                     LastMount += Val(Me.Controls.Item("NewMountTXT" & VAddad).Text)
  68.                 Else
  69.                     My.Computer.FileSystem.WriteAllText(StoresPath & "\" & Me.Controls.Item("NewStoreTXT" & VAddad).Text & "\" & ProductNameTXT.Text & ".dat", Me.Controls.Item("NewMountTXT" & VAddad).Text, False)
  70.                 End If
  71.             End If
  72.             My.Computer.FileSystem.WriteAllText(NewProductPath & "\mount" & VAddad & ".dat", Me.Controls.Item("NewMountTXT" & VAddad).Text, False)
  73.             My.Computer.FileSystem.WriteAllText(NewProductPath & "\unit" & VAddad & ".dat", Me.Controls.Item("NewUnitsTXT" & VAddad).Text, False)
  74.         Next
  75.         If StoreNumber < 1 Then
  76.             My.Computer.FileSystem.WriteAllText(NewProductPath & "\stores.dat", -1, False)
  77.         Else
  78.             My.Computer.FileSystem.WriteAllText(NewProductPath & "\stores.dat", StoreNumber - 1, False)
  79.         End If
  80.         My.Computer.FileSystem.WriteAllText(NewProductPath & "\request.dat", 0, False)
  81.         My.Computer.FileSystem.WriteAllText(NewProductPath & "\sold.dat", 0, False)
  82. Finish:
  83.     End Sub
  84.     Public Sub ZeroingText()
  85.         ProductNameTXT.Text = ""
  86.         ProductCatTXT.Text = ""
  87.         ProductTypeTXT.Text = ""
  88.         ProductCodeTXT.Text = ""
  89.         ProductPriceTXT.Text = ""
  90.         ProductTax1TXT.Text = ""
  91.         ProductTax2TXT.Text = ""
  92.         ProductPurchTXT.Text = ""
  93.         ProductMountTXT.Text = ""
  94.         ProductStoreTXT.Text = ""
  95.         ProductUnitsTXT.Text = ""
  96.         RmoveComboText()
  97.         ProductMountTXT.Enabled = True
  98.         ProductPicPIC.Image = Nothing
  99.     End Sub
  100.     Private Sub ProductAddBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductAddBTN.Click
  101.         TestText()
  102.         AddNewProduct()
  103.         ZeroingText()
  104.         LoadStore(ProductStoreTXT)
  105.         StartUp.RemoveTab()
  106.         StartUp.MainPanel.Controls.Clear()
  107.         If CalledFrom = "buy" Then
  108.             StartUp.MainPanel.Controls.Add(NewBuy.GetInstance())
  109.             StartUp.AddNewTab(NewBuy.GetInstance.Tag, NewBuy.GetInstance.Name)
  110.             NewBuy.GetInstance.AddNewBTNClick()
  111.         ElseIf CalledFrom = "sell" Then
  112.             StartUp.MainPanel.Controls.Add(NewSell.GetInstance())
  113.             StartUp.AddNewTab(NewSell.GetInstance.Tag, NewSell.GetInstance.Name)
  114.             NewSell.GetInstance.AddNewBTNClick()
  115.         ElseIf My.Computer.FileSystem.DirectoryExists(CalledFrom) = True Then
  116.             System.IO.Directory.Delete(CalledFrom, True)
  117.             StartUp.LoadAlerts()
  118.             StartUp.MainPanel.Controls.Add(MainView.GetInstance())
  119.             StartUp.AddNewTab(MainView.GetInstance.Tag, MainView.GetInstance.Name)
  120.         Else
  121.             StartUp.MainPanel.Controls.Add(MainView.GetInstance())
  122.             StartUp.AddNewTab(MainView.GetInstance.Tag, MainView.GetInstance.Name)
  123.         End If
  124.         CalledFrom = ""
  125.     End Sub
  126.     Public Sub TestText()
  127.         'test values to add errors to Alerts :
  128.         Dim PName As String = ProductNameTXT.Text
  129.         Dim WDir As String = ""
  130.         '××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
  131.         If ProductCatTXT.Text = "" Then
  132.             StartUp.AlertsWriter(PName, "لم تقم بتصنيف الـ" & PName & " , أنقر هنا لتصنيف المنتج", "cat")
  133.         Else
  134.             WDir = AlertsPath & "\" & PName & "\cat"
  135.             If My.Computer.FileSystem.DirectoryExists(WDir) Then System.IO.Directory.Delete(WDir, True)
  136.         End If
  137.         '××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
  138.         If ProductTypeTXT.Text = "" Then
  139.             StartUp.AlertsWriter(PName, "لم تقم بوضع نمط للـ" & PName & " , أنقر هنا لوضع نمط المنتج", "type")
  140.         Else
  141.             WDir = AlertsPath & "\" & PName & "\type"
  142.             If My.Computer.FileSystem.DirectoryExists(WDir) Then System.IO.Directory.Delete(WDir, True)
  143.         End If
  144.         '××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
  145.         If ProductCodeTXT.Text = "" Then
  146.             StartUp.AlertsWriter(PName, "لم تقم بوضع باركود الـ" & PName & " , أنقر هنا لوضع باركود المنتج", "bar")
  147.         Else
  148.             WDir = AlertsPath & "\" & PName & "\bar"
  149.             If My.Computer.FileSystem.DirectoryExists(WDir) Then System.IO.Directory.Delete(WDir, True)
  150.         End If
  151.         '××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
  152.         If ProductPriceTXT.Text = "" Then
  153.             StartUp.AlertsWriter(PName, "لم تقم بوضع سعر الجملة لـ" & PName & " , أنقر هنا لوضع سعر جملة المنتج", "price")
  154.         Else
  155.             WDir = AlertsPath & "\" & PName & "\price"
  156.             If My.Computer.FileSystem.DirectoryExists(WDir) Then System.IO.Directory.Delete(WDir, True)
  157.         End If
  158.         '××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
  159.         If ProductTax1TXT.Text = "" Then
  160.             StartUp.AlertsWriter(PName, "لم تقم بتعيين قيمة الضريبة الرئيسية للـ" & PName & " , أنقر هنا لتعيين ضريبة المنتج الرئيسية", "tax")
  161.         Else
  162.             WDir = AlertsPath & "\" & PName & "\tax"
  163.             If My.Computer.FileSystem.DirectoryExists(WDir) Then System.IO.Directory.Delete(WDir, True)
  164.         End If
  165.         '××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
  166.         If ProductTax2TXT.Text = "" Then
  167.             StartUp.AlertsWriter(PName, "لم تقم بتعيين قيمة الضريبة الثانوية للـ" & PName & " , أنقر هنا لتعيين ضريبة المنتج الثانوية", "subtax")
  168.         Else
  169.             WDir = AlertsPath & "\" & PName & "\subtax"
  170.             If My.Computer.FileSystem.DirectoryExists(WDir) Then System.IO.Directory.Delete(WDir, True)
  171.         End If
  172.         '××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
  173.         If ProductPurchTXT.Text = "" Then
  174.             StartUp.AlertsWriter(PName, "لم تقم بتعيين سعر مبيع الـ" & PName & " , أنقر هنا لتعيين سعر المنتج", "purch")
  175.         Else
  176.             WDir = AlertsPath & "\" & PName & "\purch"
  177.             If My.Computer.FileSystem.DirectoryExists(WDir) Then System.IO.Directory.Delete(WDir, True)
  178.         End If
  179.         '××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
  180.         If ProductStoreTXT.Text = "" Then
  181.             StartUp.AlertsWriter(PName, "لم تقم بتحدبد المخزن الرئيسي للـ" & PName & " , أنقر هنا لتعيين مخزن المنتج الرئيسي", "store")
  182.         Else
  183.             WDir = AlertsPath & "\" & PName & "\store"
  184.             If My.Computer.FileSystem.DirectoryExists(WDir) Then System.IO.Directory.Delete(WDir, True)
  185.         End If
  186.         '××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
  187.         If ProductMountTXT.Text = "" And CalledFrom = "" Then
  188.             StartUp.AlertsWriter(PName, "لم تقم بتحدبد كمية الـ" & PName & " لديك , أنقر هنا لتعيين كمية المنتج ", "amount")
  189.         Else
  190.             WDir = AlertsPath & "\" & PName & "\amount"
  191.             If My.Computer.FileSystem.DirectoryExists(WDir) Then System.IO.Directory.Delete(WDir, True)
  192.         End If
  193.         '××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
  194.         If ProductUnitsTXT.Text = "" Then
  195.             StartUp.AlertsWriter(PName, "لم تقم بتحدبد وحدة الـ" & PName & " لديك , أنقر هنا لتعيين وحدة المنتج ", "unit")
  196.         Else
  197.             WDir = AlertsPath & "\" & PName & "\unit"
  198.             If My.Computer.FileSystem.DirectoryExists(WDir) Then System.IO.Directory.Delete(WDir, True)
  199.         End If
  200.         '××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
  201.         StartUp.LoadAlerts()
  202.     End Sub
  203.     Private Sub ProductCancleBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductCancleBTN.Click
  204.         StartUp.CloseTabs()
  205.         LoadStore(ProductStoreTXT)
  206.         ZeroingText()
  207.     End Sub
  208.     Public Sub LoadCategories()
  209.         Dim Addad As Integer = 0
  210.         ProductCatTXT.Items.Clear()
  211.         For Addad = 0 To My.Computer.FileSystem.GetFiles(CatPath).Count - 1
  212.             Dim CatName As String = My.Computer.FileSystem.GetFileInfo(My.Computer.FileSystem.GetFiles(CatPath).Item(Addad)).Name
  213.             CatName = CatName.Remove(CatName.Length - 4, 4)
  214.             ProductCatTXT.Items.Add(CatName)
  215.         Next
  216.     End Sub
  217.     Public Sub LoadTypes()
  218.         Dim Addad As Integer = 0
  219.         ProductTypeTXT.Items.Clear()
  220.         ProductTypeTXT.Items.Add("منتج / سلعة")
  221.         ProductTypeTXT.Items.Add("خدمات")
  222.     End Sub
  223.     Public Sub LoadTax()
  224.         Dim Addad As Integer = 0
  225.         ProductTax1TXT.Items.Clear()
  226.         ProductTax2TXT.Items.Clear()
  227.         For Addad = 20 To 99 Step +20
  228.             ProductTax1TXT.Items.Add("0." & Addad)
  229.             ProductTax2TXT.Items.Add("0." & Addad)
  230.         Next
  231.     End Sub
  232.     Public Sub LoadStore(ByVal sender As Object)
  233.         Dim Addad As Integer = 0
  234.         sender.Items.Clear()
  235.         For Addad = 0 To My.Computer.FileSystem.GetDirectories(StoresPath).Count - 1
  236.             Dim StoreName As String = My.Computer.FileSystem.GetDirectoryInfo(My.Computer.FileSystem.GetDirectories(StoresPath).Item(Addad)).Name
  237.             sender.Items.Add(StoreName)
  238.         Next
  239.     End Sub
  240.     Public Sub LoadUnits(ByVal sender As Object)
  241.         sender.Items.AddRange(System.IO.File.ReadAllLines(DataPath & "\units.dat", System.Text.Encoding.GetEncoding(0)))
  242.     End Sub
  243.     Public Sub LoadProduct(ByRef Name As String)
  244.         On Error Resume Next
  245.         ProductNameTXT.Text = Name
  246.         ProductCatTXT.Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\cat.dat", System.Text.Encoding.GetEncoding(0))
  247.         ProductTypeTXT.Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\type.dat", System.Text.Encoding.GetEncoding(0))
  248.         ProductCodeTXT.Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\barcode.dat", System.Text.Encoding.GetEncoding(0))
  249.         ProductPriceTXT.Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\price.dat", System.Text.Encoding.GetEncoding(0))
  250.         ProductTax1TXT.Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\maintax.dat", System.Text.Encoding.GetEncoding(0))
  251.         ProductTax2TXT.Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\subtax.dat", System.Text.Encoding.GetEncoding(0))
  252.         ProductPurchTXT.Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\purch.dat", System.Text.Encoding.GetEncoding(0))
  253.         ProductStoreTXT.Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\store.dat", System.Text.Encoding.GetEncoding(0))
  254.         ProductMountTXT.Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\mount.dat", System.Text.Encoding.GetEncoding(0))
  255.         ProductUnitsTXT.Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\unit.dat", System.Text.Encoding.GetEncoding(0))
  256.         ProductPicPIC.Image = System.Drawing.Bitmap.FromFile(ProductPath & "\" & Name & "\img.pic")
  257.         CalcInter()
  258.         Dim StoresNum As Integer = Val(My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\stores.dat", System.Text.Encoding.GetEncoding(0)))
  259.         Dim MinusAddad As Integer = 0
  260.         If StoresNum > 0 Then
  261.             For MinusAddad = 0 To StoresNum
  262.                 AddNewComboText()
  263.                 Me.Controls.Item("NewStoreTXT" & MinusAddad).Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\store" & MinusAddad & ".dat", System.Text.Encoding.GetEncoding(0))
  264.                 Me.Controls.Item("NewMountTXT" & MinusAddad).Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\mount" & MinusAddad & ".dat", System.Text.Encoding.GetEncoding(0))
  265.                 Me.Controls.Item("NewUnitsTXT" & MinusAddad).Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\unit" & MinusAddad & ".dat", System.Text.Encoding.GetEncoding(0))
  266.             Next
  267.             GoTo FinishLoadingSubStore
  268.         ElseIf StoresNum = 0 Then
  269.             If My.Computer.FileSystem.FileExists(ProductPath & "\" & Name & "\mount0.dat") = True Then
  270.                 AddNewComboText()
  271.                 Me.Controls.Item("NewStoreTXT0").Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\store0.dat", System.Text.Encoding.GetEncoding(0))
  272.                 Me.Controls.Item("NewMountTXT0").Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\mount0.dat", System.Text.Encoding.GetEncoding(0))
  273.                 Me.Controls.Item("NewUnitsTXT0").Text = My.Computer.FileSystem.ReadAllText(ProductPath & "\" & Name & "\unit0.dat", System.Text.Encoding.GetEncoding(0))
  274.             Else
  275.                 GoTo FinishLoadingSubStore
  276.             End If
  277.         End If
  278. FinishLoadingSubStore:
  279.         CleanUpComboText()
  280.         TestServicesIfActivate()
  281.     End Sub
  282.     Private Sub NewProduct_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  283.         OFD.Multiselect = False
  284.         OFD.InitialDirectory = "c:\"
  285.         OFD.Title = "إنتقاء صورة للمنتج"
  286.         OFD.Filter = "jpg files (*.jpg)|*.jpg|bmp files (*.bmp)|*.bmp|png files (*.png)|*.png"
  287.         LoadCategories()
  288.         LoadTypes()
  289.         LoadTax()
  290.         LoadStore(ProductStoreTXT)
  291.         LoadUnits(ProductUnitsTXT)
  292.         ProductNameTXT.Select()
  293.     End Sub
  294.     Private Sub ProductBrowseBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductBrowseBTN.Click
  295.         OFD.ShowDialog()
  296.     End Sub
  297.     Private Sub OFD_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OFD.FileOk
  298.         ProductCleanBTN_Click(sender, e)
  299.         Dim NewProductPath As String = ProductPath & "\" & ProductNameTXT.Text
  300.         My.Computer.FileSystem.CopyFile(OFD.FileName, NewProductPath & "\img.pic")
  301.         ProductPicPIC.Image = System.Drawing.Bitmap.FromFile(NewProductPath & "\img.pic")
  302.     End Sub
  303.     Private Sub ProductCleanBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductCleanBTN.Click
  304.         On Error Resume Next
  305.         ProductPicPIC.Image = Nothing
  306.         ProductPicPIC.Refresh()
  307.         Dim TryNum As Integer = 0
  308.         If My.Computer.FileSystem.FileExists(ProductPath & "\" & ProductNameTXT.Text & "\img.pic") = False Then GoTo Finish
  309. Retry:
  310.         System.IO.File.SetAttributes(ProductPath & "\" & ProductNameTXT.Text & "\img.pic", IO.FileAttributes.Normal)
  311.         System.IO.File.Delete(ProductPath & "\" & ProductNameTXT.Text & "\img.pic")
  312.         If My.Computer.FileSystem.FileExists(ProductPath & "\" & ProductNameTXT.Text & "\img.pic") = True And TryNum < 100 Then TryNum += 1 : GoTo Retry Else MsgBox("لا يمكن التعامل مع الصورة حالياً أعد المحاولة بعد قليل")
  313. Finish:
  314.     End Sub
  315.     Private Sub ProductNameTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ProductNameTXT.KeyDown
  316.         If e.KeyCode = Keys.Enter Then ProductCatTXT.Select()
  317.     End Sub
  318.     Private Sub ProductNameTXT_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ProductNameTXT.LostFocus
  319.         If My.Computer.FileSystem.DirectoryExists(ProductPath & "\" & ProductNameTXT.Text) = False Then
  320.             ProductCatTXT.Text = ""
  321.             ProductTypeTXT.Text = ""
  322.             ProductCodeTXT.Text = ""
  323.             ProductPriceTXT.Text = ""
  324.             ProductTax1TXT.Text = ""
  325.             ProductTax2TXT.Text = ""
  326.             ProductPurchTXT.Text = ""
  327.             ProductMountTXT.Text = ""
  328.             ProductStoreTXT.Text = ""
  329.             ProductUnitsTXT.Text = ""
  330.             RmoveComboText()
  331.             ProductPicPIC.Image = Nothing
  332.             ProductAddBTN.Text = "إضافة"
  333.         End If
  334.     End Sub
  335.     Private Sub ProductNameTXT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductNameTXT.TextChanged
  336.         If My.Computer.FileSystem.DirectoryExists(ProductPath & "\" & ProductNameTXT.Text) = True And ProductNameTXT.Text <> "" Then
  337.             RmoveComboText()
  338.             LoadProduct(ProductNameTXT.Text)
  339.             ProductAddBTN.Text = "تعديل"
  340.         Else
  341.             RmoveComboText()
  342.             ProductAddBTN.Text = "إضافة"
  343.         End If
  344.     End Sub
  345.     Private Sub NewStore_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewStore.Click
  346.         AddNewComboText()
  347.     End Sub
  348.     Public Sub AddNewComboText()
  349.         Dim NewStoreTXT As New ComboBox
  350.         Dim NewMountTXT As New TextBox
  351.         Dim NewUnitsTXT As New ComboBox
  352.         Dim NewStoreLBL As New Label
  353.         Dim NewMountLBL As New Label
  354.         Dim MyLeft As Integer = 0
  355.         Dim MyTop As Integer = 0
  356.         NewStoreTXT.AutoCompleteMode = AutoCompleteMode.SuggestAppend
  357.         NewStoreTXT.AutoCompleteSource = AutoCompleteSource.ListItems
  358.         NewUnitsTXT.AutoCompleteMode = AutoCompleteMode.SuggestAppend
  359.         NewUnitsTXT.AutoCompleteSource = AutoCompleteSource.ListItems
  360.         NewStoreTXT.Width = ProductStoreTXT.Width
  361.         NewMountTXT.Width = ProductMountTXT.Width
  362.         NewUnitsTXT.Width = ProductUnitsTXT.Width
  363.         NewStoreLBL.Width = ProductStoreLBL.Width
  364.         NewMountLBL.Width = ProductMountLBL.Width
  365.         NewStoreLBL.Font = ProductStoreLBL.Font
  366.         NewMountLBL.Font = ProductMountLBL.Font
  367.         NewStoreLBL.Text = ProductStoreLBL.Text
  368.         NewMountLBL.Text = ProductMountLBL.Text
  369.         NewStoreLBL.TextAlign = ProductStoreLBL.TextAlign
  370.         NewMountLBL.TextAlign = ProductMountLBL.TextAlign
  371.         NewStoreTXT.RightToLeft = ProductStoreTXT.RightToLeft
  372.         NewMountTXT.RightToLeft = ProductStoreTXT.RightToLeft
  373.         NewUnitsTXT.RightToLeft = ProductUnitsTXT.RightToLeft
  374.         NewStoreLBL.RightToLeft = ProductStoreLBL.RightToLeft
  375.         NewMountLBL.RightToLeft = ProductStoreLBL.RightToLeft
  376.         NewStoreTXT.Name = "NewStoreTXT" & StoreNumber
  377.         NewMountTXT.Name = "NewMountTXT" & StoreNumber
  378.         NewUnitsTXT.Name = "NewUnitsTXT" & StoreNumber
  379.         NewStoreLBL.Name = "NewStoreLBL" & StoreNumber
  380.         NewMountLBL.Name = "NewMountLBL" & StoreNumber
  381.         If StoreNumber = 0 Then
  382.             MyLeft = ProductStoreTXT.Left
  383.             MyTop = ProductStoreTXT.Top + 52
  384.         Else
  385.             StoreNumber -= 1
  386.             MyLeft = Me.Controls.Item("NewStoreTXT" & StoreNumber).Left
  387.             MyTop = Me.Controls.Item("NewStoreTXT" & StoreNumber).Top + 52
  388.             StoreNumber += 1
  389.         End If
  390.         StoreNumber += 1
  391.         NewStoreTXT.Left = MyLeft
  392.         NewUnitsTXT.Left = MyLeft
  393.         NewMountTXT.Left = MyLeft + NewUnitsTXT.Width + 5
  394.         NewStoreLBL.Left = ProductStoreLBL.Left
  395.         NewMountLBL.Left = NewStoreLBL.Left
  396.         NewStoreTXT.Top = MyTop
  397.         NewMountTXT.Top = MyTop + 27
  398.         NewUnitsTXT.Top = MyTop + 27
  399.         NewStoreLBL.Top = MyTop
  400.         NewMountLBL.Top = MyTop + 27
  401.         LoadStore(NewStoreTXT)
  402.         LoadUnits(NewUnitsTXT)
  403.         NewStoreTXT.Visible = True
  404.         NewUnitsTXT.Visible = True
  405.         NewMountTXT.Visible = True
  406.         NewStoreLBL.Visible = True
  407.         NewMountLBL.Visible = True
  408.         NewStoreTXT.TabIndex = 8 + (StoreNumber * 3)
  409.         NewMountTXT.TabIndex = 9 + (StoreNumber * 3)
  410.         NewUnitsTXT.TabIndex = 10 + (StoreNumber * 3)
  411.         NewStore.Top = MyTop + 52
  412.         Me.Height += 52
  413.         Me.Controls.Add(NewStoreTXT)
  414.         Me.Controls.Add(NewUnitsTXT)
  415.         Me.Controls.Add(NewMountTXT)
  416.         Me.Controls.Add(NewStoreLBL)
  417.         Me.Controls.Add(NewMountLBL)
  418.     End Sub
  419.     Public Sub RmoveComboText()
  420.         Dim Addad As Integer = 0
  421.         For Addad = 0 To StoreNumber
  422.             Me.Controls.Remove(Me.Controls.Item("NewStoreTXT" & Addad))
  423.             Me.Controls.Remove(Me.Controls.Item("NewMountTXT" & Addad))
  424.             Me.Controls.Remove(Me.Controls.Item("NewUnitsTXT" & Addad))
  425.             Me.Controls.Remove(Me.Controls.Item("NewStoreLBL" & Addad))
  426.             Me.Controls.Remove(Me.Controls.Item("NewMountLBL" & Addad))
  427.         Next
  428.         NewStore.Top = ProductUnitsTXT.Top + 27
  429.         Me.Height = 467
  430.         StoreNumber = 0
  431.     End Sub
  432.     Public Sub CleanUpComboText()
  433.         Dim Addad As Integer = 0
  434.         For Addad = 0 To StoreNumber - 1
  435.             If Me.Controls.Item("NewStoreTXT" & Addad).Text = "" Then
  436.                 Me.Controls.Remove(Me.Controls.Item("NewStoreTXT" & Addad))
  437.                 Me.Controls.Remove(Me.Controls.Item("NewMountTXT" & Addad))
  438.                 Me.Controls.Remove(Me.Controls.Item("NewUnitsTXT" & Addad))
  439.                 Me.Controls.Remove(Me.Controls.Item("NewStoreLBL" & Addad))
  440.                 Me.Controls.Remove(Me.Controls.Item("NewMountLBL" & Addad))
  441.                 NewStore.Top -= 52
  442.                 Me.Height -= 52
  443.                 StoreNumber -= 1
  444.             End If
  445.         Next
  446.     End Sub
  447.     Public Sub CalcInter()
  448.         Dim InterValue As Double = 0
  449.         Dim TaxValue As Double = 0
  450.         TaxValue = Val(Val(ProductPriceTXT.Text) * Val(ProductTax1TXT.Text) / 100) + Val(Val(ProductPriceTXT.Text) * Val(ProductTax2TXT.Text) / 100)
  451.         InterValue = Val(ProductPurchTXT.Text) - Val(ProductPriceTXT.Text) - TaxValue
  452.         InterestLBL.Text = "الربح : " & InterValue & " , قيمة الضرائب : " & TaxValue
  453.     End Sub
  454.     Private Sub ProductPriceTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ProductPriceTXT.KeyDown
  455.         If e.KeyCode = Keys.Enter Then ProductTax1TXT.Select()
  456.     End Sub
  457.     Private Sub ProductPriceTXT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductPriceTXT.TextChanged
  458.         CalcInter()
  459.     End Sub
  460.     Private Sub ProductPurchTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ProductPurchTXT.KeyDown
  461.         If e.KeyCode = Keys.Enter Then ProductStoreTXT.Select()
  462.     End Sub
  463.     Private Sub ProductPurchTXT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductPurchTXT.TextChanged
  464.         CalcInter()
  465.     End Sub
  466.     Private Sub ProductTax1TXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ProductTax1TXT.KeyDown
  467.         If e.KeyCode = Keys.Enter Then ProductTax2TXT.Select()
  468.     End Sub
  469.     Private Sub ProductTax1TXT_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ProductTax1TXT.TextChanged
  470.         CalcInter()
  471.     End Sub
  472.     Private Sub ProductTax2TXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ProductTax2TXT.KeyDown
  473.         If e.KeyCode = Keys.Enter Then ProductPurchTXT.Select()
  474.     End Sub
  475.     Private Sub ProductTax2TXT_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ProductTax2TXT.TextChanged
  476.         CalcInter()
  477.     End Sub
  478.     Private Sub ProductTypeTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ProductTypeTXT.KeyDown
  479.         If e.KeyCode = Keys.Enter Then ProductCodeTXT.Select()
  480.     End Sub
  481.     Private Sub ProductTypeTXT_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductTypeTXT.SelectedIndexChanged
  482.         TestServicesIfActivate()
  483.     End Sub
  484.     Private Sub ProductCatTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ProductCatTXT.KeyDown
  485.         If e.KeyCode = Keys.Enter Then ProductTypeTXT.Select()
  486.     End Sub
  487.     Private Sub ProductCodeTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ProductCodeTXT.KeyDown
  488.         If e.KeyCode = Keys.Enter Then ProductPriceTXT.Select()
  489.     End Sub
  490.     Private Sub ProductStoreTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ProductStoreTXT.KeyDown
  491.         If e.KeyCode = Keys.Enter Then ProductMountTXT.Select()
  492.     End Sub
  493.     Private Sub ProductMountTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ProductMountTXT.KeyDown
  494.         If e.KeyCode = Keys.Enter Then ProductUnitsTXT.Select()
  495.     End Sub
  496.     Private Sub ProductUnitsTXT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ProductUnitsTXT.KeyDown
  497.         If e.KeyCode = Keys.Enter Then ProductAddBTN.Select()
  498.     End Sub
  499.     Public Sub TestServicesIfActivate()
  500.         LastPriceInformation(0) = Val(ProductPriceTXT.Text)
  501.         LastPriceInformation(1) = Val(ProductTax1TXT.Text)
  502.         LastPriceInformation(2) = Val(ProductTax2TXT.Text)
  503.         If ProductTypeTXT.Text = "خدمات" Then
  504.             ProductPriceTXT.Text = 0
  505.             ProductPriceTXT.Enabled = False
  506.             ProductTax1TXT.Text = 0
  507.             ProductTax1TXT.Enabled = False
  508.             ProductTax2TXT.Text = 0
  509.             ProductTax2TXT.Enabled = False
  510.             ProductPurchLBL.Text = "سعر الخدمة :"
  511.             ProductCodeTXT.Text = "-"
  512.             ProductCodeTXT.Enabled = False
  513.             ProductMountTXT.Text = 0
  514.             ProductMountTXT.Enabled = False
  515.             ProductUnitsTXT.Text = "قطعة"
  516.             ProductUnitsTXT.Enabled = False
  517.             NewStore.Enabled = False
  518.         Else
  519.             'If LastPriceInformation(0) <> 0 Then
  520.             ProductPriceTXT.Text = LastPriceInformation(0)
  521.             ProductPriceTXT.Enabled = True
  522.             ProductTax1TXT.Text = LastPriceInformation(1)
  523.             ProductTax1TXT.Enabled = True
  524.             ProductTax2TXT.Text = LastPriceInformation(2)
  525.             ProductTax2TXT.Enabled = True
  526.             ProductPurchLBL.Text = "سعر المبيع :"
  527.             ProductCodeTXT.Enabled = True
  528.             ProductMountTXT.Enabled = True
  529.             ProductUnitsTXT.Enabled = True
  530.             NewStore.Enabled = True
  531.             'Else
  532.             'ProductPriceTXT.Enabled = True
  533.             'ProductTax1TXT.Enabled = True
  534.             'ProductTax2TXT.Enabled = True
  535.             'End If
  536.         End If
  537.     End Sub
  538. End Class

Valuable E-Book

Hello,
Baby first step is a friendly flashcards offering a growing collection of creative and educational ideas to help the toddler to learn the alphabet, so I put images that would be attractive to babies.

Support independent publishing: Buy this e-book on Lulu.