none
How can i create the continuous data begin with data 001 and end with 101 in visual studio 2017. I already have the code but it not functioning as i want. RRS feed

  • Question

  • my code

    Private Sub

        Dim QueNo as Integer

        Dim StartValue as Integer

        Dim EndValue as Integer

        StartValue = 001

        EndValue = 101

       For QueNo = StartValue To EndValue

             MsgBox ("Message Box show" QueNo  "Times")

             If QueNo = 003 then

             Exit For

             End If

         Next QueNo

    End Sub


    • Edited by Kazuki89 Friday, April 20, 2018 2:36 AM
    Friday, April 20, 2018 2:34 AM

Answers

  • Hi Cor.. i actually in my progress build a Queue Up Calling System for medical specialist hospital. My system will prompt patient to take the ticket number and choose their favourite Clinic for their treatment.

    Example scenario is the patient A is a first customer. He or She then choose Clinic x. The patient A then will push the Clinic X button on my system and my system will print the ticket of number 001. He or She then get the doctor treatment. 

    Next is Patient B as a second customer. He or She then choose the same clinic (Clinic X). The patient B then will push the Clinic X button on my system and my system will print the ticket of number 002. He or She then wait for they turn to get treatment.

    My idea is i want my system can continuosly print the ticket number from 001 until 101. 

    Sorry for the my bad explaination, Cor.


    Kazuki,

    It is very well described. If you had done it in the first question you had already this code. 

    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Static number As Integer = 1
            MessageBox.Show(number.ToString("000"))
            number += 1
            If number > 101 Then number = 1
        End Sub
    End Class
    Be aware, I give the code for your question, I'm not busy here with making programs here and show those with as result that other persons are without a job. 


    Success
    Cor



    • Edited by Cor Ligthert Saturday, April 21, 2018 9:17 AM
    • Marked as answer by Kazuki89 Wednesday, April 25, 2018 7:41 AM
    Saturday, April 21, 2018 7:57 AM
  • Your Welcome Ashidaachi,

    i share my design system UI roughly at Dropbox

    https://www.dropbox.com/s/7xy3dd84t3xux72/Clinic%20X%20User%20Interface%20design%20roughly.jpg?dl=0

    https://www.dropbox.com/s/ivi5my1cg9stb9u/Patient%20User%20Interface%20design.jpg?dl=0

    please assist me on how i can make my system working. Thank You Sir.



    You don't mention the controls you are using. I guess this may be what you are trying to do.

    It should show from 001 to 999 before returning to 001. You can alter it to only go to 101 before returning to 1 if you want.

    Option Strict On
    
    Public Class Form1
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Me.Location = New Point(CInt((Screen.PrimaryScreen.WorkingArea.Width / 2) - (Me.Width / 2)), CInt((Screen.PrimaryScreen.WorkingArea.Height / 2) - (Me.Height / 2)))
    
            Label1.BorderStyle = BorderStyle.FixedSingle
            Label1.Text = ""
            Label1.TextAlign = ContentAlignment.MiddleCenter
            Label1.AutoSize = False
            Label1.Left = Button1.Left
            Label1.Size = New Size(Button1.Width, Button1.Height * 2)
            Label1.MinimumSize = New Size(Button1.Width, Button1.Height * 2)
            Label1.MaximumSize = New Size(Button1.Width, Button1.Height * 2)
    
            Label2.BorderStyle = BorderStyle.FixedSingle
            Label2.Text = ""
            Label2.TextAlign = ContentAlignment.MiddleCenter
            Label2.AutoSize = False
            Label2.Left = Button2.Left
            Label2.Size = New Size(Button2.Width, Button2.Height * 2)
            Label2.MinimumSize = New Size(Button2.Width, Button2.Height * 2)
            Label2.MaximumSize = New Size(Button2.Width, Button2.Height * 2)
    
            Label3.BorderStyle = BorderStyle.FixedSingle
            Label3.Text = ""
            Label3.TextAlign = ContentAlignment.MiddleCenter
            Label3.AutoSize = False
            Label3.Left = Button3.Left
            Label3.Size = New Size(Button3.Width, Button3.Height * 2)
            Label3.MinimumSize = New Size(Button3.Width, Button3.Height * 2)
            Label3.MaximumSize = New Size(Button3.Width, Button3.Height * 2)
    
            Label4.BorderStyle = BorderStyle.FixedSingle
            Label4.Text = ""
            Label4.TextAlign = ContentAlignment.MiddleCenter
            Label4.AutoSize = False
            Label4.Left = Button4.Left
            Label4.Size = New Size(Button4.Width, Button4.Height * 2)
            Label4.MinimumSize = New Size(Button4.Width, Button4.Height * 2)
            Label4.MaximumSize = New Size(Button4.Width, Button4.Height * 2)
        End Sub
    
        Dim ClinicATicket As Integer = 1
    
        Private Sub ClinicA_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Label1.Text = ClinicATicket.ToString.PadLeft(3, "0"c)
            ClinicATicket += 1
            If ClinicATicket = 1000 Then ClinicATicket = 1
        End Sub
    
        Dim ClinicBTicket As Integer = 1
    
        Private Sub ClinicB_Click(sender As Object, e As EventArgs) Handles Button2.Click
            Label2.Text = ClinicBTicket.ToString.PadLeft(3, "0"c)
            ClinicBTicket += 1
            If ClinicBTicket = 1000 Then ClinicBTicket = 1
        End Sub
    
        Dim ClinicCTicket As Integer = 1
    
        Private Sub ClinicC_Click(sender As Object, e As EventArgs) Handles Button3.Click
            Label3.Text = ClinicCTicket.ToString.PadLeft(3, "0"c)
            ClinicCTicket += 1
            If ClinicCTicket = 1000 Then ClinicCTicket = 1
        End Sub
    
        Dim ClinicDTicket As Integer = 1
    
        Private Sub ClinicD_Click(sender As Object, e As EventArgs) Handles Button4.Click
            Label4.Text = ClinicDTicket.ToString.PadLeft(3, "0"c)
            ClinicDTicket += 1
            If ClinicDTicket = 1000 Then ClinicDTicket = 1
        End Sub
    
    End Class


    La vida loca

    • Edited by Mr. Monkeyboy Saturday, April 21, 2018 7:08 PM
    • Marked as answer by Kazuki89 Wednesday, July 11, 2018 3:26 AM
    Saturday, April 21, 2018 7:07 PM

All replies

  • Private Sub Sub_ID()
    
            Dim QueNo As Integer
    
            Dim StartValue As Integer
    
            Dim EndValue As Integer
    
            StartValue = 1
    
            EndValue = 101
    
            For QueNo = StartValue To EndValue
    
                MsgBox("Message Box show " + QueNo.ToString() + " Times")
    
                If QueNo = 3 Then
    
                    Exit For
    
                End If
    
            Next QueNo
    
        End Sub

    Friday, April 20, 2018 2:42 AM
  • Thank you Mr Vikram for assist with my code. 
    • Edited by Kazuki89 Friday, April 20, 2018 3:00 AM
    Friday, April 20, 2018 2:59 AM
  • Not sure what you want to do with the values, here is something to consider.

    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            ' store in a variable for later use
            Dim result = Enumerable.Range(1, 101).Select(Function(item) item.ToString("D3"))
    
            ' create and display
            Enumerable.Range(1, 101).
                Select(Function(item) item.ToString("D3")).
                ToList().
                ForEach(Sub(item) Console.WriteLine(item))
        End Sub
    End Class
    

    And

    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    
            Dim StartValue As Integer = 1
    
            Dim EndValue As Integer = 101
    
            ' create and display
            Enumerable.Range(1, 101).
                Select(Function(item) item.ToString("D3")).
                ToList().
                ForEach(Sub(item) Console.WriteLine(item))
        End Sub
    End Class
    


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, April 20, 2018 8:53 AM
    Moderator
  •  I already have the code but it not functioning as i want.

    What do you want?


    Success
    Cor

    Friday, April 20, 2018 10:50 AM
  • Hi Karen.. i actually in my progress build a Queue Up Calling System for medical specialist hospital. My system will prompt patient to take the ticket number and choose their favourite Clinic for their treatment.

    Example scenario is the patient A is a first customer. He or She then choose Clinic x. The patient A then will push the Clinic X button on my system and my system will print the ticket of number 001. He or She then get the doctor treatment. 

    Next is Patient B as a second customer. He or She then choose the same clinic (Clinic X). The patient B then will push the Clinic X button on my system and my system will print the ticket of number 002. He or She then wait for they turn to get treatment.

    My idea is i want my system can continuosly print the ticket number from 001 until 101 in sequence. 

    Sorry for my bad explaination. My apologize. 

    Thank you for assist me, Karen. i really appreciate it



    • Edited by Kazuki89 Saturday, April 21, 2018 1:48 AM
    Saturday, April 21, 2018 1:40 AM
  • Hi Cor.. i actually in my progress build a Queue Up Calling System for medical specialist hospital. My system will prompt patient to take the ticket number and choose their favourite Clinic for their treatment.

    Example scenario is the patient A is a first customer. He or She then choose Clinic x. The patient A then will push the Clinic X button on my system and my system will print the ticket of number 001. He or She then get the doctor treatment. 

    Next is Patient B as a second customer. He or She then choose the same clinic (Clinic X). The patient B then will push the Clinic X button on my system and my system will print the ticket of number 002. He or She then wait for they turn to get treatment.

    My idea is i want my system can continuosly print the ticket number from 001 until 101. 

    Sorry for the my bad explaination, Cor.


    • Edited by Kazuki89 Saturday, April 21, 2018 1:48 AM
    Saturday, April 21, 2018 1:40 AM
  • Hi Ashidacchi.. i actually in my progress build a Queue Up Calling System for medical specialist hospital. My system will prompt patient to take the ticket number and choose their favourite Clinic for their treatment.

    Example scenario is the patient A is a first customer. He or She then choose Clinic x. The patient A then will push the Clinic X button on my system and my system will print the ticket of number 001. He or She then get the doctor treatment. 

    Next is Patient B as a second customer. He or She then choose the same clinic (Clinic X). The patient B then will push the Clinic X button on my system and my system will print the ticket of number 002. He or She then wait for they turn to get treatment.

    My idea is i want my system can continuosly print the ticket number from 001 until 101 in sequence.

    Sorry for my bad explanation, Ashidacchi.  Thank you


    • Edited by Kazuki89 Saturday, April 21, 2018 1:51 AM
    Saturday, April 21, 2018 1:41 AM
  • Your Welcome Ashidaachi,

    i share my design system UI roughly at Dropbox

    https://www.dropbox.com/s/7xy3dd84t3xux72/Clinic%20X%20User%20Interface%20design%20roughly.jpg?dl=0

    https://www.dropbox.com/s/ivi5my1cg9stb9u/Patient%20User%20Interface%20design.jpg?dl=0

    please assist me on how i can make my system working. Thank You Sir.



    • Edited by Kazuki89 Saturday, April 21, 2018 3:48 AM
    Saturday, April 21, 2018 3:07 AM
  • Thank you Mr Vikram for assist with my code. 

    Hi Vikram, the coding not working. But thanks for assist me. I appreciate it.

    Saturday, April 21, 2018 3:23 AM
  • Hi Cor.. i actually in my progress build a Queue Up Calling System for medical specialist hospital. My system will prompt patient to take the ticket number and choose their favourite Clinic for their treatment.

    Example scenario is the patient A is a first customer. He or She then choose Clinic x. The patient A then will push the Clinic X button on my system and my system will print the ticket of number 001. He or She then get the doctor treatment. 

    Next is Patient B as a second customer. He or She then choose the same clinic (Clinic X). The patient B then will push the Clinic X button on my system and my system will print the ticket of number 002. He or She then wait for they turn to get treatment.

    My idea is i want my system can continuosly print the ticket number from 001 until 101. 

    Sorry for the my bad explaination, Cor.


    Kazuki,

    It is very well described. If you had done it in the first question you had already this code. 

    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Static number As Integer = 1
            MessageBox.Show(number.ToString("000"))
            number += 1
            If number > 101 Then number = 1
        End Sub
    End Class
    Be aware, I give the code for your question, I'm not busy here with making programs here and show those with as result that other persons are without a job. 


    Success
    Cor



    • Edited by Cor Ligthert Saturday, April 21, 2018 9:17 AM
    • Marked as answer by Kazuki89 Wednesday, April 25, 2018 7:41 AM
    Saturday, April 21, 2018 7:57 AM
  • Your Welcome Ashidaachi,

    i share my design system UI roughly at Dropbox

    https://www.dropbox.com/s/7xy3dd84t3xux72/Clinic%20X%20User%20Interface%20design%20roughly.jpg?dl=0

    https://www.dropbox.com/s/ivi5my1cg9stb9u/Patient%20User%20Interface%20design.jpg?dl=0

    please assist me on how i can make my system working. Thank You Sir.



    You don't mention the controls you are using. I guess this may be what you are trying to do.

    It should show from 001 to 999 before returning to 001. You can alter it to only go to 101 before returning to 1 if you want.

    Option Strict On
    
    Public Class Form1
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Me.Location = New Point(CInt((Screen.PrimaryScreen.WorkingArea.Width / 2) - (Me.Width / 2)), CInt((Screen.PrimaryScreen.WorkingArea.Height / 2) - (Me.Height / 2)))
    
            Label1.BorderStyle = BorderStyle.FixedSingle
            Label1.Text = ""
            Label1.TextAlign = ContentAlignment.MiddleCenter
            Label1.AutoSize = False
            Label1.Left = Button1.Left
            Label1.Size = New Size(Button1.Width, Button1.Height * 2)
            Label1.MinimumSize = New Size(Button1.Width, Button1.Height * 2)
            Label1.MaximumSize = New Size(Button1.Width, Button1.Height * 2)
    
            Label2.BorderStyle = BorderStyle.FixedSingle
            Label2.Text = ""
            Label2.TextAlign = ContentAlignment.MiddleCenter
            Label2.AutoSize = False
            Label2.Left = Button2.Left
            Label2.Size = New Size(Button2.Width, Button2.Height * 2)
            Label2.MinimumSize = New Size(Button2.Width, Button2.Height * 2)
            Label2.MaximumSize = New Size(Button2.Width, Button2.Height * 2)
    
            Label3.BorderStyle = BorderStyle.FixedSingle
            Label3.Text = ""
            Label3.TextAlign = ContentAlignment.MiddleCenter
            Label3.AutoSize = False
            Label3.Left = Button3.Left
            Label3.Size = New Size(Button3.Width, Button3.Height * 2)
            Label3.MinimumSize = New Size(Button3.Width, Button3.Height * 2)
            Label3.MaximumSize = New Size(Button3.Width, Button3.Height * 2)
    
            Label4.BorderStyle = BorderStyle.FixedSingle
            Label4.Text = ""
            Label4.TextAlign = ContentAlignment.MiddleCenter
            Label4.AutoSize = False
            Label4.Left = Button4.Left
            Label4.Size = New Size(Button4.Width, Button4.Height * 2)
            Label4.MinimumSize = New Size(Button4.Width, Button4.Height * 2)
            Label4.MaximumSize = New Size(Button4.Width, Button4.Height * 2)
        End Sub
    
        Dim ClinicATicket As Integer = 1
    
        Private Sub ClinicA_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Label1.Text = ClinicATicket.ToString.PadLeft(3, "0"c)
            ClinicATicket += 1
            If ClinicATicket = 1000 Then ClinicATicket = 1
        End Sub
    
        Dim ClinicBTicket As Integer = 1
    
        Private Sub ClinicB_Click(sender As Object, e As EventArgs) Handles Button2.Click
            Label2.Text = ClinicBTicket.ToString.PadLeft(3, "0"c)
            ClinicBTicket += 1
            If ClinicBTicket = 1000 Then ClinicBTicket = 1
        End Sub
    
        Dim ClinicCTicket As Integer = 1
    
        Private Sub ClinicC_Click(sender As Object, e As EventArgs) Handles Button3.Click
            Label3.Text = ClinicCTicket.ToString.PadLeft(3, "0"c)
            ClinicCTicket += 1
            If ClinicCTicket = 1000 Then ClinicCTicket = 1
        End Sub
    
        Dim ClinicDTicket As Integer = 1
    
        Private Sub ClinicD_Click(sender As Object, e As EventArgs) Handles Button4.Click
            Label4.Text = ClinicDTicket.ToString.PadLeft(3, "0"c)
            ClinicDTicket += 1
            If ClinicDTicket = 1000 Then ClinicDTicket = 1
        End Sub
    
    End Class


    La vida loca

    • Edited by Mr. Monkeyboy Saturday, April 21, 2018 7:08 PM
    • Marked as answer by Kazuki89 Wednesday, July 11, 2018 3:26 AM
    Saturday, April 21, 2018 7:07 PM
  • Hi Kazuki89,

    Thank you for sharing screenshots of your Forms.
    Let me ask some question.
    (1) Which control is [Ticket Number]? A Button, TextBox...?
       Is [Ticket Numver] for only showing a sequential number on the form?

    (2) How many Clinics do you want to put on the form?  If [A] - [Z], it is 26.

    (3) Is there possibility that the number of Clinics will vary in the future?
       If it will vary, we need to think about creating controls dynamically, i.e. create them in code, instead of putting them on a form in Designer View.

    I would like to made a sample/prototype project but I do know insufficient requirement for your system.

    Regards,

    Ashidacchi -- http://hokusosha.com/


    Hi Ashidacchi, 

    (1) The control of TexBox is show the Ticket Number. When Patient click the Ticket Number TextBox, the Ticket number is show up. 

    (2) There are Seven Clinic will used this system. Sorry sir, i forgot to mention it.

    (3) If this system working, there will be THREE addition clinic will added. 

     Thank you for the reply Ashidacchi.  

    Monday, April 23, 2018 1:08 AM
  • Hi Cor Ligthert

    Thank you for your assist me. The coding is well complete what my idea is Cor.

    Best Regard

    Kazuki89

    • Marked as answer by Kazuki89 Wednesday, July 11, 2018 3:26 AM
    • Unmarked as answer by Kazuki89 Wednesday, July 11, 2018 3:26 AM
    Wednesday, April 25, 2018 7:46 AM
  • Hi Mr. Monkeyboy

    Thank you for give me the ideas of how i can managed my System well.

    i appreciate all your help to me Mr. Monkeyboy.

    Wednesday, April 25, 2018 7:50 AM