:D snasui.com ยินดีต้อนรับ :D
ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย :thup: สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ :arrow: ระบุ Version ของ Excel
:!: โปรดทราบ :!:
  1. กรุณาอ่านกฎการใช้บอร์ด (Forum rules) ในตำแหน่งด้านบนของแต่ละบอร์ด
  2. การสมัครสมาชิก การ Login การกู้คืนรหัสผ่าน
    1. สมัครสมาชิกดูขั้นตอนได้ที่ :arrow: สมัครสมาชิก
    2. Login เข้าระบบโดยคลิกปุ่ม Login ตรงมุมขวาบนของหน้านี้ :roll:
    3. การ Login ผ่าน Facebook ดูวิธีที่ :arrow: Login ผ่าน Facebook
    4. ลืมรหัสผ่านสามารถรับรหัสใหม่ได้ที่ :arrow: Reset รหัสผ่าน
  3. มีปัญหาการใช้งาน แจ้งผู้ดูแลระบบได้ที่ :arrow: ติดต่อผู้ดูแลระบบ
  4. กำหนดการตั้งค่าส่วนตัว เช่นตั้งค่าภาษาเป็นไทยหรืออังกฤษดูได้ที่ :arrow: ตั้งค่าส่วนตัว
  5. การตั้งและตอบกระทู้ดูได้ที่ :arrow: วิธีการตั้งและตอบกระทู้
  6. การจัดรูปแบบตัวอักษรด้วย bbcode ในช่องแสดงความคิดเห็นดูได้ที่ :arrow: จัดรูปแบบตัวอักษร
  7. กำหนดขนาดตัวอักษรใน Browser ดูได้ที่ :arrow: กำหนดขนาดตัวอักษรใน Browser

ปรึกษา Code vb.net ต้อง Load MsgBox จึงจะทำงานได้ หากไม่ต้องการให้ Load แต่ว่ายังทำงานได้ ต้องปรับ Code อย่างไรครับ

ฟอรัมถาม-ตอบเกี่ยวกับ Visual Basic
Forum rules
  1. ไม่อนุญาตให้ใช้ภาษาแชทในการถามและตอบปัญหา ไม่ใช้คำว่า "คับ" หรือ "อ่ะครับ" แทนคำว่า "ครับ" ไม่ใช้คำว่า "เด๋ว" แทนคำว่า "เดี๋ยว" เป็นต้น เนื่องจากเมื่อแปลเป็นภาษาต่างประเทศแล้วจะให้ความหมายผิดไปจากที่ควรจะเป็น
  2. ห้ามถามโดยระบุชื่อผู้ตอบและต้องตั้งชื่อกระทู้ให้สื่อถึงปัญหาที่จะถาม ไม่ตั้งชื่อว่า ช่วยด้วยครับ, มีปัญหามาปรึกษาครับ เป็นต้น
  3. กรุณาอธิบายปัญหาและระบุคำตอบที่ต้องการมาในกระทู้ด้วยเสมอถึงแม้จะอธิบายไว้ในไฟล์แนบแล้วก็ตาม ทั้งนี้เพื่ออำนวยความสะดวกแก่เพื่อนสมาชิกในการค้นหาข้อมูล
  4. กรุณาแนบไฟล์ตัวอย่างพร้อมแสดงคำตอบที่ถูกต้องมาในไฟล์ด้วยเพื่อให้ง่ายต่อการทำความเข้าใจและสะดวกต่อการตอบคำถาม (ขนาดไฟล์ไม่เกิน 500Kb ขนาดภาพไม่เกิน 800*600 Pixel) ไม่แนบเป็น Link มาจากแหล่งอื่นที่อาจจะถูกลบทิ้งไปโดยต้นทางในภายหลัง นอกจากนี้ไม่ควรแนบไฟล์ที่มีข้อมูลสำคัญอันก่อให้เกิดความเสียหายกับตนเองและผู้อื่น
  5. กรณีเป็นคำถามเกี่ยวกับ Programming เช่น VBA, VB.Net, C#, SQL ฯลฯ ต้องลองเขียนมาเองก่อนเสมอ ถามเฉพาะที่ติดปัญหา ระบุ Module, Procedure ที่ติดปัญหาให้ชัดเจน กรุณาโพสต์ Code ให้แสดงเป็น Code คือเปิดด้วย [code] และปิดด้วย [/code] ตัวอย่างเช่น [code]dim r as range[/code] เพื่อให้แตกต่างจากข้อความทั่วไป สะดวกในการอ่านและทดสอบ (คลิกเพื่อดูตัวอย่างเพิ่มเติม)
  6. กรุณาแจ้งผลการใช้งานเมื่อได้รับคำตอบว่าตรงกับความต้องการหรือไม่
User avatar
cheapache
Member
Member
Posts: 72
Joined: Mon Sep 07, 2015 10:39 am

ปรึกษา Code vb.net ต้อง Load MsgBox จึงจะทำงานได้ หากไม่ต้องการให้ Load แต่ว่ายังทำงานได้ ต้องปรับ Code อย่างไรครับ

#1

Post by cheapache »

ผมมีปัญหาโค๊ดที่ช่วง formload ครับ ถ้าไม่ใส่คำสั่ง MessageBox เข้าไป ข้อความที่ listbox ใน form1 จะไม่แสดงครับ
แต่หากใส่ MessageBox ใน formload เมื่อรันโปรแกรมจะขึ้นกล่องข้อความ และเมื่อกด OK form1 จะโชว์และค่าใน listbox ก็จะแสดงครับ

โค๊ดใน formload

Code: Select all

  Public Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
        '    Timerstart
        Timer1.Start()
        Timer2.Start()

        MessageBox.Show("Start program...", "WiFiLogtech Message:...")

        ' Readtextfile Temp.Calibration_Rm
        Try
            Dim F As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor2\Calibration_Rm.txt")
            Row = Split(F.ReadToEnd, vbNewLine)
            F.Close()

            CL = Row(0).Split(",")
            FN = CL(1)
            CL = Row(1).Split(",")
            Location1 = CL(1)
            CL = Row(2).Split(",")
            Maxt = CL(1)
            CL = Row(3).Split(",")
            Mint = CL(1)
            CL = Row(4).Split(",")
            Maxh = CL(1)
            CL = Row(5).Split(",")
            Minh = CL(1)
            CL = Row(6).Split(",")
            Series = CL(1)
            CL = Row(7).Split(",")
            Duedate = CL(1)

            ' Readtextfile Lubricant3_Rm
            Dim F2 As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor2\Lubricant3_Rm.txt")
            Row2 = Split(F2.ReadToEnd, vbNewLine)
            F2.Close()

            CL2 = Row2(0).Split(",")
            FN2 = CL2(1)
            CL2 = Row2(1).Split(",")
            Location2 = CL2(1)
            CL2 = Row2(2).Split(",")
            Maxt2 = CL2(1)
            CL2 = Row2(3).Split(",")
            Mint2 = CL2(1)
            CL2 = Row2(4).Split(",")
            Maxh2 = CL2(1)
            CL2 = Row2(5).Split(",")
            Minh2 = CL2(1)
            CL2 = Row2(6).Split(",")
            Series2 = CL2(1)
            CL2 = Row2(7).Split(",")
            Duedate2 = CL2(1)

            ' Readtextfile Lubricant2_Rm
            Dim F3 As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor2\Lubricant2_Rm.txt")
            Row3 = Split(F3.ReadToEnd, vbNewLine)
            F3.Close()

            CL3 = Row3(0).Split(",")
            FN3 = CL3(1)
            CL3 = Row3(1).Split(",")
            Location3 = CL3(1)
            CL3 = Row3(2).Split(",")
            Maxt3 = CL3(1)
            CL3 = Row3(3).Split(",")
            Mint3 = CL3(1)
            CL3 = Row3(4).Split(",")
            Maxh3 = CL3(1)
            CL3 = Row3(5).Split(",")
            Minh3 = CL3(1)
            CL3 = Row3(6).Split(",")
            Series3 = CL3(1)
            CL3 = Row3(7).Split(",")
            Duedate3 = CL3(1)

            ' Readtextfile Lubricant1_Rm
            Dim F4 As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor2\Lubricant1_Rm.txt")
            Row4 = Split(F4.ReadToEnd, vbNewLine)
            F4.Close()

            CL4 = Row4(0).Split(",")
            FN4 = CL4(1)
            CL4 = Row4(1).Split(",")
            Location4 = CL4(1)
            CL4 = Row4(2).Split(",")
            Maxt4 = CL4(1)
            CL4 = Row(3).Split(",")
            Mint4 = CL4(1)
            CL4 = Row4(4).Split(",")
            Maxh4 = CL4(1)
            CL4 = Row4(5).Split(",")
            Minh4 = CL4(1)
            CL4 = Row4(6).Split(",")
            Series4 = CL4(1)
            CL4 = Row4(7).Split(",")
            Duedate4 = CL4(1)

            ' Readtextfile ICP_Rm
            Dim F5 As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor1\ICP_Rm.txt")
            Row5 = Split(F5.ReadToEnd, vbNewLine)
            F5.Close()

            CL5 = Row5(0).Split(",")
            FN5 = CL5(1)
            CL5 = Row5(1).Split(",")
            Location5 = CL5(1)
            CL5 = Row5(2).Split(",")
            Maxt5 = CL5(1)
            CL5 = Row5(3).Split(",")
            Mint5 = CL5(1)
            CL5 = Row5(4).Split(",")
            Maxh5 = CL5(1)
            CL5 = Row5(5).Split(",")
            Minh5 = CL5(1)
            CL5 = Row5(6).Split(",")
            Series5 = CL5(1)
            CL5 = Row5(7).Split(",")
            Duedate5 = CL(1)

            ' Readtextfile GC_Rm
            Dim F6 As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor1\GC_Rm.txt")
            Row6 = Split(F6.ReadToEnd, vbNewLine)
            F6.Close()

            CL6 = Row6(0).Split(",")
            FN6 = CL6(1)
            CL6 = Row6(1).Split(",")
            Location6 = CL6(1)
            CL6 = Row6(2).Split(",")
            Maxt6 = CL6(1)
            CL6 = Row6(3).Split(",")
            Mint6 = CL6(1)
            CL6 = Row6(4).Split(",")
            Maxh6 = CL6(1)
            CL6 = Row6(5).Split(",")
            Minh6 = CL6(1)
            CL6 = Row6(6).Split(",")
            Series6 = CL6(1)
            CL6 = Row6(7).Split(",")
            Duedate6 = CL6(1)

            ' Readtextfile Sulfer_Rm
            Dim F7 As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor1\Sulfer_Rm.txt")
            Row7 = Split(F7.ReadToEnd, vbNewLine)
            F7.Close()

            CL7 = Row7(0).Split(",")
            FN7 = CL7(1)
            CL7 = Row7(1).Split(",")
            Location7 = CL7(1)
            CL7 = Row7(2).Split(",")
            Maxt7 = CL7(1)
            CL7 = Row7(3).Split(",")
            Mint7 = CL7(1)
            CL7 = Row7(4).Split(",")
            Maxh7 = CL7(1)
            CL7 = Row7(5).Split(",")
            Minh7 = CL7(1)
            CL7 = Row7(6).Split(",")
            Series7 = CL7(1)
            CL7 = Row7(7).Split(",")
            Duedate7 = CL7(1)

            ' Readtextfile Flashpoint_Rm
            Dim F8 As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor1\Flashpoint_Rm.txt")
            Row8 = Split(F8.ReadToEnd, vbNewLine)
            F8.Close()

            CL8 = Row8(0).Split(",")
            FN8 = CL8(1)
            CL8 = Row8(1).Split(",")
            Location8 = CL8(1)
            CL8 = Row8(2).Split(",")
            Maxt8 = CL8(1)
            CL8 = Row8(3).Split(",")
            Mint8 = CL8(1)
            CL8 = Row8(4).Split(",")
            Maxh8 = CL8(1)
            CL8 = Row8(5).Split(",")
            Minh8 = CL8(1)
            CL8 = Row8(6).Split(",")
            Series8 = CL8(1)
            CL8 = Row8(7).Split(",")
            Duedate8 = CL8(1)

            ' Readtextfile Wast_Water_Rm
            Dim F9 As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor3\Wast_Water_Rm.txt")
            Row9 = Split(F9.ReadToEnd, vbNewLine)
            F9.Close()

            CL9 = Row9(0).Split(",")
            FN9 = CL9(1)
            CL9 = Row9(1).Split(",")
            Location9 = CL9(1)
            CL9 = Row9(2).Split(",")
            Maxt9 = CL9(1)
            CL9 = Row9(3).Split(",")
            Mint9 = CL9(1)
            CL9 = Row9(4).Split(",")
            Maxh9 = CL9(1)
            CL9 = Row9(5).Split(",")
            Minh9 = CL9(1)
            CL9 = Row9(6).Split(",")
            Series9 = CL9(1)
            CL9 = Row9(7).Split(",")
            Duedate9 = CL9(1)

            ' Readtextfile Fuel_Rm
            Dim F10 As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor3\Fuel_Rm.txt")
            Row10 = Split(F10.ReadToEnd, vbNewLine)
            F10.Close()

            CL10 = Row10(0).Split(",")
            FN10 = CL10(1)
            CL10 = Row10(1).Split(",")
            Location10 = CL10(1)
            CL10 = Row10(2).Split(",")
            Maxt10 = CL10(1)
            CL10 = Row10(3).Split(",")
            Mint10 = CL10(1)
            CL10 = Row10(4).Split(",")
            Maxh10 = CL10(1)
            CL10 = Row10(5).Split(",")
            Minh10 = CL10(1)
            CL10 = Row10(6).Split(",")
            Series10 = CL10(1)
            CL10 = Row10(7).Split(",")
            Duedate10 = CL10(1)

            ' Readtextfile 305_Rm
            Dim F11 As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor3\309_Rm.txt")
            Row11 = Split(F11.ReadToEnd, vbNewLine)
            F11.Close()
            CL11 = Row11(0).Split(",")
            FN11 = CL11(1)
            CL11 = Row11(1).Split(",")
            Location11 = CL11(1)
            CL11 = Row11(2).Split(",")
            Maxt11 = CL11(1)
            CL11 = Row11(3).Split(",")
            Mint11 = CL11(1)
            CL11 = Row11(4).Split(",")
            Maxh11 = CL11(1)
            CL11 = Row11(5).Split(",")
            Minh11 = CL11(1)
            CL11 = Row11(6).Split(",")
            Series11 = CL11(1)
            CL11 = Row11(7).Split(",")
            Duedate11 = CL11(1)

            ' Readtextfile 308_Rm
            Dim F12 As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor3\308_Rm.txt")
            Row12 = Split(F12.ReadToEnd, vbNewLine)
            F12.Close()

            CL12 = Row12(0).Split(",")
            FN12 = CL12(1)
            CL12 = Row12(1).Split(",")
            Location12 = CL12(1)
            CL12 = Row12(2).Split(",")
            Maxt12 = CL12(1)
            CL12 = Row12(3).Split(",")
            Mint12 = CL12(1)
            CL12 = Row12(4).Split(",")
            Maxh12 = CL12(1)
            CL12 = Row12(5).Split(",")
            Minh12 = CL12(1)
            CL12 = Row12(6).Split(",")
            Series12 = CL12(1)
            CL12 = Row12(7).Split(",")
            Duedate12 = CL12(1)

            ' Readtextfile FT-IR_Rm
            Dim F13 As StreamReader = New System.IO.StreamReader("C:\Scrip\Floor3\FT-IR_Rm.txt")
            Row13 = Split(F13.ReadToEnd, vbNewLine)
            F13.Close()

            CL13 = Row13(0).Split(",")
            FN13 = CL13(1)
            CL13 = Row13(1).Split(",")
            Location13 = CL13(1)
            CL13 = Row13(2).Split(",")
            Maxt13 = CL13(1)
            CL13 = Row13(3).Split(",")
            Mint13 = CL13(1)
            CL13 = Row13(4).Split(",")
            Maxh13 = CL13(1)
            CL13 = Row13(5).Split(",")
            Minh13 = CL13(1)
            CL13 = Row13(6).Split(",")
            Series13 = CL13(1)
            CL13 = Row13(7).Split(",")
            Duedate13 = CL13(1)
        Catch ex As Exception

        End Try


        Dim thread = New Thread(New System.Threading.ThreadStart(AddressOf Me.Hosting_port))
        thread.Start()

        NotifyIcon1.BalloonTipText = "Program Is running : Please wait..."
        NotifyIcon1.Text = "Moniterparametor Application"
        NotifyIcon1.ShowBalloonTip(5000)
        CreateContextMenu()



        Try
            Dim result As Integer = DateTime.Compare(txtDueDate, Duedate)
            If result >= 0 Then
                Dim a As String = "Please Cal. " & Series & " on " & Location1 & " before " & Duedate & ""
                ListBox1.Items.Add(a)
            End If

            Dim result2 As Integer = DateTime.Compare(txtDueDate, Duedate2)
            If result2 >= 0 Then
                Dim b As String = "Please Cal. " & Series2 & " on " & Location2 & " before " & Duedate2 & ""
                ListBox1.Items.Add(b)
            End If

            Dim result3 As Integer = DateTime.Compare(txtDueDate, Duedate3)
            If result3 >= 0 Then
                Dim c As String = "Please Cal. " & Series3 & " on " & Location3 & " before " & Duedate3 & ""
                ListBox1.Items.Add(c)
            End If

            Dim result4 As Integer = DateTime.Compare(txtDueDate, Duedate4)
            If result4 >= 0 Then
                Dim d As String = "Please Cal. " & Series4 & " on " & Location4 & " before " & Duedate4 & ""
                ListBox1.Items.Add(d)
            End If

            Dim result5 As Integer = DateTime.Compare(txtDueDate, Duedate5)
            If result5 >= 0 Then
                Dim ff As String = "Please Cal. " & Series5 & " on " & Location5 & " before " & Duedate5 & ""
                ListBox1.Items.Add(ff)
            End If

            Dim result6 As Integer = DateTime.Compare(txtDueDate, Duedate6)
            If result6 >= 0 Then
                Dim g As String = "Please Cal. " & Series6 & " on " & Location6 & " before " & Duedate6 & ""
                ListBox1.Items.Add(g)
            End If

            Dim result7 As Integer = DateTime.Compare(txtDueDate, Duedate7)
            If result7 >= 0 Then
                Dim h As String = "Please Cal. " & Series7 & " on " & Location7 & " before " & Duedate7 & ""
                ListBox1.Items.Add(h)
            End If

            Dim result8 As Integer = DateTime.Compare(txtDueDate, Duedate8)
            If result8 >= 0 Then
                Dim i As String = "Please Cal. " & Series8 & " on " & Location8 & " before " & Duedate8 & ""
                ListBox1.Items.Add(i)
            End If

            Dim result9 As Integer = DateTime.Compare(txtDueDate, Duedate9)
            If result9 >= 0 Then
                Dim j As String = "Please Cal. " & Series9 & " on " & Location9 & " before " & Duedate9 & ""
                ListBox1.Items.Add(j)
            End If

            Dim result10 As Integer = DateTime.Compare(txtDueDate, Duedate10)
            If result10 >= 0 Then
                Dim k As String = "Please Cal. " & Series10 & " on " & Location10 & " before " & Duedate10 & ""
                ListBox1.Items.Add(k)
            End If

            Dim result11 As Integer = DateTime.Compare(txtDueDate, Duedate11)
            If result11 >= 0 Then
                Dim l As String = "Please Cal. " & Series11 & " on " & Location11 & " before " & Duedate11 & ""
                ListBox1.Items.Add(l)
            End If

            Dim result12 As Integer = DateTime.Compare(txtDueDate, Duedate12)
            If result12 >= 0 Then
                Dim m As String = "Please Cal. " & Series12 & " on " & Location12 & " before " & Duedate12 & ""
                ListBox1.Items.Add(m)
            End If

            Dim result13 As Integer = DateTime.Compare(txtDueDate, Duedate13)
            If result13 >= 0 Then
                Dim n As String = "Please Cal. " & Series13 & " on " & Location13 & " before " & Duedate13 & ""
                ListBox1.Items.Add(n)
            End If
        Catch ex As Exception

        End Try

    End Sub
ลิ้งโปรเจ็คครับ https://drive.google.com/folderview?id= ... sp=sharing
User avatar
snasui
Site Admin
Site Admin
Posts: 30744
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 365
Contact:

Re: ปรึกษา Code vb.net ต้อง Load MsgBox จึงจะทำงานได้ หากไม่ต้องการให้ Load แต่ว่ายังทำงานได้ ต้องปรับ Code อย่างไรครับ

#2

Post by snasui »

:D ช่วย Zip Project ให้เป็นไฟล์เดียวกันจะได้สะดวกในการดาวน์โหลดมาทดสอบครับ
User avatar
snasui
Site Admin
Site Admin
Posts: 30744
Joined: Sun Jan 24, 2010 12:33 pm
Location: Songkhla, Thailand
Excel Ver: 2010, 365
Contact:

Re: ปรึกษา Code vb.net ต้อง Load MsgBox จึงจะทำงานได้ หากไม่ต้องการให้ Load แต่ว่ายังทำงานได้ ต้องปรับ Code อย่างไรครับ

#4

Post by snasui »

:D ไฟล์ Project มีขนาดใหญ่ผมไม่สามารถดาวน์โหลดได้เนื่องจากใช้ Aircard ความเร็วเนตน้อย คงต้องรอช่วงวันหยุดและผมกลับไปบ้านจึงได้จะได้ใช้เนตเร็ว ๆ ครับ
Post Reply