none
improving performance of my windows App. in VB.Net RRS feed

  • Question

  • I'm new in programming by VB.net ,But actually i've windows App. that i've created it four months ago and now i almost completed and finished it .

    How can i improve my application performance .?

    When i searched in the web i found an expression called "Threading" but i didn't understand it .

    Any suggestions to solve my issue or to guide me to the right way

    thanks in advance

    Wednesday, October 18, 2017 4:45 PM

Answers

  • The last two screenshots when i performed tracing to the second form

    Two problems stand out.  You are re-using the default frm2, so that means you need to clear the controls.   It will be quicker to create a new frm2 instance as required.   You are starting the timer before there is any data to be tested - don't start the timer until the data is available.   I am sure there is a better method than using the timer, but if you do it like that then make sure the timer tick interval is suitably long.

    • Marked as answer by Amr_Aly Sunday, October 22, 2017 9:45 PM
    Wednesday, October 18, 2017 8:48 PM

All replies

  • What does your app do? SQL database? Draw graphics? Search the web?

    If you explain it and show the basic code method then maybe someone can suggest something.

    With the info you have given all we can say is become a better programmer and your app will also become better.

    :)

    PS Why do you think threading will help?

    Wednesday, October 18, 2017 4:52 PM
  • What does your app do? SQL database? Draw graphics? Search the web?

    If you explain it and show the basic code method then maybe someone can suggest something.

    With the info you have given all we can say is become a better programmer and your app will also become better.

    :)

    PS Why do you think threading will help?

    Thanks Tommy for paying attention ,

    This question was in a VBA forum and i was not able to change the related topic to Visual Basic but by chance i changed it,So this is the link to my details here 

     
    Wednesday, October 18, 2017 5:05 PM
  • PS Why do you think threading will help?

    Thanks Tommy for paying attention ,

    This question was in a VBA forum and i was not able to change the related topic to Visual Basic but by chance i changed it,So this is the link to my details here 

     

    Just trying to move the thread along. :)

    So did you try .paul's suggestion in the other thread to time some things so you have something to go by as improved.

    Oh, what do you consider optimized performance to be? Run faster? What do you want to run faster? I don't want to learn your app. You tell us. SQL database? Graphics? Web search? What does your app do?

    Why do you think threading will help. Did you understand the discussion in the other thread?

    Wednesday, October 18, 2017 5:32 PM
  • Thanks Tommy for paying attention ,

    This question was in a VBA forum and i was not able to change the related topic to Visual Basic but by chance i changed it,So this is the link to my details here 

     

    Just trying to move the thread along. :)

    So did you try .paul's suggestion in the other thread to time some things so you have something to go by as improved.

    Oh, what do you consider optimized performance to be? Run faster? What do you want to run faster? I don't want to learn your app. You tell us. SQL database? Graphics? Web search? What does your app do?

    Why do you think threading will help. Did you understand the discussion in the other thread?

    I think that you misunderstand Tommy ,Did you read my first post in the other thread ?,I think you didn't read any thing,If you red my question and my first post ,you were knew what kind of DB i use and what kind of my app. 

    No one said that you want to learn my app. and i won't tell you anything 

    I think that you didn't understand the discussion in the other thread.

    thank you, you are a polite man


    • Edited by Amr_Aly Wednesday, October 18, 2017 6:14 PM
    Wednesday, October 18, 2017 6:12 PM
  • What does your app do? SQL database? Draw graphics? Search the web?

    If you explain it and show the basic code method then maybe someone can suggest something.

    With the info you have given all we can say is become a better programmer and your app will also become better.

    :)

    PS Why do you think threading will help?

    Thanks Tommy for paying attention ,

    This question was in a VBA forum and i was not able to change the related topic to Visual Basic but by chance i changed it,So this is the link to my details here 

     

    Maybe one of the moderators can merge the posts from both forums and put the in the correct place.

    "Those who use Application.DoEvents() have no idea what it does and those who know what it does never use it." - MSDN User JohnWein    Multics - An OS ahead of its time.

    Wednesday, October 18, 2017 6:49 PM
  • https://social.msdn.microsoft.com/Forums/en-US/e1305a60-970e-4389-a12b-219b0c9fc8a3/improving-performance-of-my-windows-app-in-vbnet?forum=isvvba


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Thanks Paul,

    Do you like to continue in the other forum?

    I'm trying Tracing and i think that will help me to solve my issue ,I will tell you when i reach to a real thing 

    Thanks in advance Paul

    • Edited by Amr_Aly Wednesday, October 18, 2017 7:30 PM
    Wednesday, October 18, 2017 7:27 PM
  • Amr_Aly,

    I think it would be helpful if you'd show some screenshots of what your program is and does.

    No promises here, but I'll try to help if I can.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Wednesday, October 18, 2017 7:40 PM
  • Amr_Aly,

    I think it would be helpful if you'd show some screenshots of what your program is and does.

    No promises here, but I'll try to help if I can.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Thanks Frank,

    Here my first and second form 


    The last two screenshots when i performed tracing to the second form
    • Edited by Amr_Aly Wednesday, October 18, 2017 8:18 PM
    Wednesday, October 18, 2017 8:08 PM
  • Amr_Aly,

    You're loading up a lot of data, no doubt. It may just take that long - so is your question "how to speed it up" or is it, more appropriately, "how to keep my UI responsive while it loads"?

    There's a difference, of course.

    I'm not a database guy but Paul Clement is and he can make suggestions for speeding things up like only getting part of the data (the part you need).

    As for keeping your UI active, you might be right about using threading and the newest (and suggested) way is with Task-Based Async.

    *****

    I'm out of my bailiwick here but you're in the right place for the answers. :)


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Wednesday, October 18, 2017 8:20 PM
  • The last two screenshots when i performed tracing to the second form

    Two problems stand out.  You are re-using the default frm2, so that means you need to clear the controls.   It will be quicker to create a new frm2 instance as required.   You are starting the timer before there is any data to be tested - don't start the timer until the data is available.   I am sure there is a better method than using the timer, but if you do it like that then make sure the timer tick interval is suitably long.

    • Marked as answer by Amr_Aly Sunday, October 22, 2017 9:45 PM
    Wednesday, October 18, 2017 8:48 PM
  • Two problems stand out.  You are re-using the default frm2, so that means you need to clear the controls.   It will be quicker to create a new frm2 instance as required.   You are starting the timer before there is any data to be tested - don't start the timer until the data is available.   I am sure there is a better method than using the timer, but if you do it like that then make sure the timer tick interval is suitably long.

    Thanks Acamar,

    I'm a new programmer so i'm not understand this(You are re-using the default frm2, so that means you need to clear the controls. ) and How can i (don't start the timer until the data is available.) ? 

    And what's the better method than using the Timer_Tick ? Please sir more details .this is my code to go to the second form

    Sub GotoVisitPH()
            frm2.Show()
            f1.Hide()
            Timer1.Start()
    
            frm2.ClearData()
            frm2.ClearDrug()
            frm2.txtComplain.Text = "" : frm2.txtSign.Text = "" : frm2.txtDiagnosis.Text = ""
            frm2.txtIntervention.Text = "" : frm2.txtAmount.Text = ""
            frm2.txtVisNo.Text = GetAutonumber("Visits", "Visit_no")
            frm2.txtVisPatNo.Text = txtNo.Text
            frm2.txtVisName.Text = cbxPatName.Text
             RunCommand("UPDATE Visits Set Name='" & cbxPatName.Text & "' WHERE Patient_no=" & txtNo.Text)
            frm2.Fill_Visits()
        End Sub


    • Edited by Amr_Aly Wednesday, October 18, 2017 9:08 PM
    Wednesday, October 18, 2017 9:07 PM
  • Two problems stand out.  You are re-using the default frm2, so that means you need to clear the controls.   It will be quicker to create a new frm2 instance as required.   You are starting the timer before there is any data to be tested - don't start the timer until the data is available.   I am sure there is a better method than using the timer, but if you do it like that then make sure the timer tick interval is suitably long.

    Thanks Acamar,

    I'm a new programmer so i'm not understand this(You are re-using the default frm2, so that means you need to clear the controls. ) and How can i (don't start the timer until the data is available.) ? 

    And what's the better method than using the Timer_Tick ? Please sir more details .this is my code to go to the second form

    Sub GotoVisitPH()
            frm2.Show()
            f1.Hide()
            Timer1.Start()
    
            frm2.ClearData()
            frm2.ClearDrug()
            frm2.txtComplain.Text = "" : frm2.txtSign.Text = "" : frm2.txtDiagnosis.Text = ""
            frm2.txtIntervention.Text = "" : frm2.txtAmount.Text = ""
            frm2.txtVisNo.Text = GetAutonumber("Visits", "Visit_no")
            frm2.txtVisPatNo.Text = txtNo.Text
            frm2.txtVisName.Text = cbxPatName.Text
             RunCommand("UPDATE Visits Set Name='" & cbxPatName.Text & "' WHERE Patient_no=" & txtNo.Text)
            frm2.Fill_Visits()
        End Sub


    I didn't see any code up until now.

    *****

    Are you using VB Net or VB6? A lot of that has a VB6 style to it, certainly.

    *****

    Do you understand what Acamar means with the term "default instance" (and he's right about load time of a default instance compared to creating a new instance)?

    *****

    What does the timer do??


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Wednesday, October 18, 2017 9:22 PM

  • Sub GotoVisitPH()
            frm2.Show()
            f1.Hide()
            Timer1.Start()
    
            frm2.ClearData()
            frm2.ClearDrug()
            frm2.txtComplain.Text = "" : frm2.txtSign.Text = "" : frm2.txtDiagnosis.Text = ""
            frm2.txtIntervention.Text = "" : frm2.txtAmount.Text = ""
            frm2.txtVisNo.Text = GetAutonumber("Visits", "Visit_no")
            frm2.txtVisPatNo.Text = txtNo.Text
            frm2.txtVisName.Text = cbxPatName.Text
             RunCommand("UPDATE Visits Set Name='" & cbxPatName.Text & "' WHERE Patient_no=" & txtNo.Text)
            frm2.Fill_Visits()
        End Sub

    I didn't see any code up until now.

    *****

    Are you using VB Net or VB6? A lot of that has a VB6 style to it, certainly.

    *****

    Do you understand what Acamar means with the term "default instance" (and he's right about load time of a default instance compared to creating a new instance)?

    *****

    What does the timer do??


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    I'm using VB.Net . 

    I don't understand but i posted that i want more details,

    in my first hand in VB.Net (when i needed to open another form i found that "me.hide() + form2.show() or from2.showdialog() + Timer.start()) when i tested it ,It worked well and when (i commented Timer.start or forgot it the button didn't take me to the second form) But (when you said "What does the timer do??") I tried it without timer.start() and it's working now



    • Edited by Amr_Aly Wednesday, October 18, 2017 9:45 PM
    Wednesday, October 18, 2017 9:44 PM
  • One of the best ways to figure out how to deal with performance issues is to first identify the issue(s) rather than looking for a solution that may or may not work.

    The IDE has plenty of tools such as IntelliTrace to assist with this. Once you review the output of the diagnostic hub (in regards to IntelliTrace) you can see what operations are taking more time than others. Couple this up with learning to use some of the other debug and performance tools. Figure out what needs to be done or come back here and ask using information that was extracted from the tools above.

    Threading does not mean faster. keep that in mind too.


    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

    Wednesday, October 18, 2017 9:51 PM
    Moderator

  • I'm using VB.Net . 

    I don't understand but i posted that i want more details,

    in my first hand in VB.Net (when i needed to open another form i found that "me.hide() + form2.show() or from2.showdialog() + Timer.start()) when i tested it ,It worked well and when (i commented Timer.start or forgot it the button didn't take me to the second form) But (when you said "What does the timer do??") I tried it without timer.start() and it's working now



    It takes a while to understand how all of these pieces fit together (and when some don't, or shouldn't) so I understand. ;-)

    A form is a class - or I should say, it's an instance of a derived class (derived from System.Windows.Forms).

    Another way to state that is that it's an object. Let's start there by clicking that link please.

    Little at a time, you'll "get it" why you need to create a NEW instance each time. Only VB allows default instances of forms - and that's something that MS decided years ago that's been debated ever since.

    Creating a NEW instance will help get you where you want though, so instead of diverting this topic into many sub-topics, let's stay at the high level for now.

    *****

    I see that Karen has posted and I'll be back tomorrow. There's lots of good info here, so ... stay tuned. :)


    "A problem well stated is a problem half solved.” - Charles F. Kettering


    • Edited by Frank L. Smith Wednesday, October 18, 2017 10:10 PM ...typo
    Wednesday, October 18, 2017 9:54 PM
  • I'm a new programmer so i'm not understand this(You are re-using the default frm2, so that means you need to clear the controls. ) and How can i (don't start the timer until the data is available.) ? 

    And what's the better method than using the Timer_Tick ?

    Instead of

    Sub GotoVisitPH()
            frm2.Show()
            f1.Hide()
            Timer1.Start()
            frm2.ClearData()
            frm2.ClearDrug()
            frm2.txtComplain.Text = "" : frm2.txtSign.Text = "" : frm2.txtDiagnosis.Text = ""
            frm2.txtIntervention.Text = "" : frm2.txtAmount.Text = ""
            frm2.txtVisNo.Text = GetAutonumber("Visits", "Visit_no")
            ...
        End Sub
    

    use

    Sub GotoVisitPH()
            Dim ThisForm2 as New frm2
            ThisForm2.Show   
            Me.Hide()
            ThisForm2.txtVisNo.Text = GetAutonumber("Visits", "Visit_no")
            ...
            Timer1.Start()
        End Sub
    

    It's not entirely clear what you are doing with the timer, but it seems that you could use TextChanged events instead to catch when any of the textboxes gets a new value that might need a new time calculation.  But in any case make sure the timer tick interval is suitably long.

    It is not reasonable to expect people to access two separate threads in order to locate the information needed to respond to your problem.


    • Edited by Acamar Wednesday, October 18, 2017 9:58 PM fmt
    Wednesday, October 18, 2017 9:57 PM
  • Threading does not mean faster. keep that in mind too.

    It depends on the specifics.

    Parallelism [may] speed things up tremendously and it's part of the Threading namespace.

    In that regard then -- you can't say that it does not; only that it may not. :-0


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Wednesday, October 18, 2017 10:07 PM
  • One of the best ways to figure out how to deal with performance issues is to first identify the issue(s) rather than looking for a solution that may or may not work.

    The IDE has plenty of tools such as IntelliTrace to assist with this. Once you review the output of the diagnostic hub (in regards to IntelliTrace) you can see what operations are taking more time than others. Couple this up with learning to use some of the other debug and performance tools. Figure out what needs to be done or come back here and ask using information that was extracted from the tools above.

    Threading does not mean faster. keep that in mind too.


    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

    Thanks Karen,

    Here you will know that i identified my issue well, I'm here for learning not for gaining an answer only, my programming age in VB.Net is 4 months only if this forum is for experts only (I'm sorry i didn't know) so please forgive me mam......

    indeed i'm using (TRACING) to solve my issue instead of (IntelliTrace) .I'm using VS2015 community.

    Threading just an expression i found it on the web so i asked the experts here for the right way . 

    I'm sorry for inconvenience (Beginner wants to learn can i  ?)

    Thanks in advance Karen 

    Wednesday, October 18, 2017 10:17 PM
  • Okay, I picked one thing from the post you linked too. In ShowAttachTable, you use SELECT *, never use SELECT * unless you intend to use every field. Never load a DataTable to get to one row of data, instead use Dim Reader = cmd.ExecuteReader then use If Reader.HasRows, if true then execute Reader.Read followed by Reader.Getxxx e.g. Reader.GetString(n) where n is the ordinal position of the field in the SELECT statement. In regards to ? for a parameter, instead use a named parameter e.g. @Visit_no

    SELECT * FROM AtFile WHERE Visit_no=@Visit_no
    Many times it's the little things that can help speed things up. The above by itself will not speed things up noticeably but it's a start.


    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

    Wednesday, October 18, 2017 10:34 PM
    Moderator
  • Okay, I picked one thing from the post you linked too. In ShowAttachTable, you use SELECT *, never use SELECT * unless you intend to use every field. Never load a DataTable to get to one row of data, instead use Dim Reader = cmd.ExecuteReader then use If Reader.HasRows, if true then execute Reader.Read followed by Reader.Getxxx e.g. Reader.GetString(n) where n is the ordinal position of the field in the SELECT statement. In regards to ? for a parameter, instead use a named parameter e.g. @Visit_no

    SELECT * FROM AtFile WHERE Visit_no=@Visit_no
    Many times it's the little things that can help speed things up. The above by itself will not speed things up noticeably but it's a start.

    Wait wait wait, slow down!

    So he should only load what he needs and he can do that using what you showed. Good idea. That will (or should) speed things up.

    Now let's say he needs just one DataRow. Explain that in detail please.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Wednesday, October 18, 2017 10:39 PM
  • ... if this forum is for experts only (I'm sorry i didn't know)

    You're fine. :)

    *****

    I said earlier that you posted in the right place and I'm very sure of it. You see now why.

    If this is a place for experts only then I've been in the wrong place for nearly a decade now. ;-)


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Wednesday, October 18, 2017 10:48 PM
  • Sample coming shorting, just returned home :-)

    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

    Wednesday, October 18, 2017 11:22 PM
    Moderator
  • Okay, I do everything (and encourage you to do the same) with classes.

    DataOperations is for data operations

    Customers is a concrete class for our Customer table in our SQL-Server database table.

    Imports System.Data.SqlClient
    Public Class DataOperations
    
        ''' <summary>
        ''' Replace with your SQL Server name
        ''' </summary>
        Private Server As String = "KARENS-PC"
        ''' <summary>
        ''' Database in which data resides, see SQL_Script.sql
        ''' </summary>
        Private Catalog As String = "CustomerDatabase"
        ''' <summary>
        ''' Connection string for connecting to the database
        ''' </summary>
        Private ConnectionString As String = ""
        Public HasErrors As Boolean
        Public ErrorMessage As String
        ''' <summary>
        ''' Setup the connection string
        ''' </summary>
        Public Sub New()
            ConnectionString = $"Data Source={Server};Initial Catalog={Catalog};Integrated Security=True"
        End Sub
        Public Function GetCompanyContact(ByVal pCompanyName As String) As Customer
            ' object to return
            Dim cust As Customer
    
            ' create a connection to the database, it will close and dispose itself
            Using cn As SqlConnection = New SqlConnection With {.ConnectionString = ConnectionString}
                ' create command to get what we came for
                Using cmd As SqlCommand = New SqlCommand With {.Connection = cn}
                    ' our SQL SELECT nicely formatted
                    cmd.CommandText =
                        <SQL>
                            SELECT 
                                ContactName,
                                ContactTitle 
                            FROM Customer 
                            WHERE CompanyName = @CompanyName
                        </SQL>.Value
    
                    ' pop-in our company name to the WHERE condition of the SELECT statement
                    cmd.Parameters.AddWithValue("@CompanyName", pCompanyName)
    
                    Try
                        ' open the connection
                        cn.Open()
    
                        ' execute the query
                        Dim reader = cmd.ExecuteReader()
                        ' see if we got one row
                        If reader.HasRows Then
                            ' we did, load it into a new customer object
                            reader.Read()
                            cust = New Customer With
                            {
                                .ContactName = reader.GetString(0),
                                .ContactTitle = reader.GetString(1)
                            }
                        End If
                    Catch ex As Exception
                        ' if we encountered a run time exception we trap it here
                        HasErrors = True
                        ErrorMessage = ex.Message
                    End Try
                End Using
            End Using
    
            ' this will be populated if HasRows returned true else it will
            ' be nothing and we check for that in the form. There are other
            ' ways to do this but I'm keeping it simple.
            Return cust
    
        End Function
    End Class
    
    

    .

    Public Class Customer
        Public Property Identifier As Integer
        Public Property CompanyName As String
        Public Property ContactName As String
        Public Property ContactTitle As String
    End Class
    

    The form has two TextBoxes, two Button.

    Public Class Form1
        ''' <summary>
        ''' Company Exists so TextBoxes get populated
        ''' </summary>
        ''' <param name="sender"></param>
        ''' <param name="e"></param>
        Private Sub cmdFound_Click(sender As Object, e As EventArgs) Handles cmdFound.Click
            Dim ops As New DataOperations
            Dim CompanyName As String = "Karen's fish"
    
            ' note I selected a company with an apostrophe which we escape in the parameter e.g. AddWithValue in our data class
            Dim customer As Customer = ops.GetCompanyContact(CompanyName)
    
            If customer IsNot Nothing Then
                txtContactName.Text = customer.ContactName
                txtContactTitle.Text = customer.ContactTitle
            Else
                If ops.HasErrors Then
                    ' we encountered a run time exception, report it to the user
                    MessageBox.Show($"Encountered errors{Environment.NewLine}{ops.ErrorMessage}")
                Else
                    ' no contact found
                    MessageBox.Show($"Customer: {CompanyName} not located")
                End If
            End If
        End Sub
        ''' <summary>
        ''' Company does not exists, we get the MessageBox
        ''' </summary>
        ''' <param name="sender"></param>
        ''' <param name="e"></param>
        Private Sub cmdNotFound_Click(sender As Object, e As EventArgs) Handles cmdNotFound.Click
            Dim ops As New DataOperations
            Dim CompanyName As String = "Company Does Not Exist"
            ' note I selected a company with an apostrophe which we escape in the parameter e.g. AddWithValue in our data class
            Dim customer As Customer = ops.GetCompanyContact(CompanyName)
    
            If customer IsNot Nothing Then
                txtContactName.Text = customer.ContactName
                txtContactTitle.Text = customer.ContactTitle
            Else
                If ops.HasErrors Then
                    ' we encountered a run time exception, report it to the user
                    MessageBox.Show($"Encountered errors{Environment.NewLine}{ops.ErrorMessage}")
                Else
                    ' no contact found
                    MessageBox.Show($"Customer: {CompanyName} not located")
                End If
            End If
        End Sub
    End Class
    

    Existing data

    Table schema

    The above shows the basics of properly obtaining only the data we want, two fields in one row using the SQL-Server data provider SqlClient.

    Make sure to read the code comments!!!


    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

    Thursday, October 19, 2017 12:03 AM
    Moderator
  • It is not reasonable to expect people to access two separate threads in order to locate the information needed to respond to your problem.


    I apologize sir to every one here in this forum but i tried to change the related topic of my first question in VBA forum but i failed and when i tried another time it changed by chance so i became have two question. It's not my fault (I think moderator must merge them together). Please accept my apologize thanks sir.................

    Any ways, in my first hand in VB.Net (when i needed to open another form i found that i have to do this"me.hide() + form2.show() or from2.showdialog() + Timer.start()) Ah, i want go to the second form with the same name of patient and with the ID number(Patient No) so the timer enable me to do this ..

    In order to enable you to solve my issue i think that you have take a look at this 

     
    Thursday, October 19, 2017 8:02 AM
  • Ah, i want go to the second form with the same name of patient and with the ID number(Patient No)

    Then you should create a constructor for that second form so that you can pass in the ID of the patient when the form is created, and the form constructor can access the details and populate the form controls as the form is created.  Where is the patient ID - is it txtNo.Text?  The code would look something like

    Sub GotoVisitPH()
           
    Dim ThisForm2 as New frm2(txtNo.Text)
            ThisForm2
    .Show  
           
    Me.Hide()
    End Sub

    so you could then move the form initialize code into the constructor of that second form, where it belongs.  See: https://vbdotnetblog.wordpress.com/forms/97-2/ for an example of passing a value to a constructor.

    Posting images is not usually helpful - what is needed is the code you are actually using posted in this thread.

    Thursday, October 19, 2017 9:54 AM
  • It is not reasonable to expect people to access two separate threads in order to locate the information needed to respond to your problem.


    I apologize sir to every one here in this forum but i tried to change the related topic of my first question in VBA forum but i failed and when i tried another time it changed by chance so i became have two question. It's not my fault (I think moderator must merge them together). Please accept my apologize thanks sir.................

    Amr,

    We look at this as a learning forum. Although it says Microsoft there is really no one from microsoft here. We are all volunteers.

    After a certin number of questions, it becomes obvious that the hardest thing for us is to understand the question. So we play the questions game asking the person asking the question questions about what they mean. Its not to be mean. Its to understand the question.

    Broad statements like how can I improve my application are pretty hard to answer.

    So we try to zoom in on exactly what the problem or question is.

    Sometimes we try to teach how to ask a question first. So we tell you the standard procedures to make your question clear. Again its not to be mean. Its to understand the question.

    You as the original poster that asked the question need to understand. We have answered many questions. You have not. We have improved the performance of many apps. You have not. We know what our questions are. You do not. We have years of doing this. You do not.

    So its very simple. We know the routine. You do not. Dont take it personl. Its just the way it is. You are learning... so are we!

    But its your question not ours. You need to do what it takes to get your answer. If that means copying your stuff a few times then you need to do it. Thats what it takes for you to get your question answered. Thats all. Its up to you. Not us.

    And we make mistakes so you need to quide us to your question and answer. Not the other way around.

    :)


    Thursday, October 19, 2017 1:10 PM
  • Ah, i want go to the second form with the same name of patient and with the ID number(Patient No)

    Then you should create a constructor for that second form so that you can pass in the ID of the patient when the form is created, and the form constructor can access the details and populate the form controls as the form is created.  Where is the patient ID - is it txtNo.Text?  The code would look something like

    Sub GotoVisitPH()
            Dim ThisForm2 as New frm2(txtNo.Text)
            ThisForm2.Show  
            Me.Hide()
    End Sub

    so you could then move the form initialize code into the constructor of that second form, where it belongs.  See: https://vbdotnetblog.wordpress.com/forms/97-2/ for an example of passing a value to a constructor.

    Posting images is not usually helpful - what is needed is the code you are actually using posted in this thread.

    Thanks Acamar,

    It's good sir that i gained a new information but when i write this code (as the article said) in form1

            Dim f2 = New frm2(cbxPatName.Text)
            f2.Show()
            f1.Hide()

    and this code in the Sub New in form2

    Public Sub New(Optional S As String = "", Optional N As String = "")
            MyBase.New()
            Trace.WriteLine("New STARTED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            Application.EnableVisualStyles()
            'Application.DoEvents()
            'This call is required by the Windows Form Designer.
            InitializeComponent()
            'Add any initialization after the InitializeComponent() call
            txtVisName.Text = S
            txtVisPatNo.Text = N
            ds = New DataSet
            da = New OleDbDataAdapter("SELECT * FROM Visits ORDER BY Visit_no", conn)
            da.Fill(ds, "Visits")
            dgvVisit.DataSource = ds.Tables("Visits")
            ''''''''''''''''''''''''''''
            ds1 = New DataSet
            da1 = New OleDbDataAdapter("SELECT * FROM Inves", conn)
            da1.Fill(ds1, "Inves")
            dgvInv.DataSource = ds1.Tables("Inves")
            ''''''''''''''''''''''''''''
            ds2 = New DataSet
            da2 = New OleDbDataAdapter("select * from AtFile", conn)
            da2.Fill(ds2, "AtFile")
            dgvAtt.DataSource = ds2.Tables("AtFile")
            ''''''''''''''''''''''''''''
            f2.SuspendLayout()
            f2.Visible = True
            f2.ResumeLayout()
            Trace.WriteLine("New FINISHED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
        End Sub

    ( " Object Reference Not Set To An Instance Of An Object " ) appear again after I've forgotten it 

     
    Thursday, October 19, 2017 1:27 PM
  • It is not reasonable to expect people to access two separate threads in order to locate the information needed to respond to your problem.


    Amr,

    We look at this as a learning forum. Although it says Microsoft there is really no one from microsoft here. We are all volunteers.

    After a certin number of questions, it becomes obvious that the hardest thing for us is to understand the question. So we play the questions game asking the person asking the question questions about what they mean. Its not to be mean. Its to understand the question.

    Broad statements like how can I improve my application are pretty hard to answer.

    So we try to zoom in on exactly what the problem or question is.

    Sometimes we try to teach how to ask a question first. So we tell you the standard procedures to make your question clear. Again its not to be mean. Its to understand the question.

    You as the original poster that asked the question need to understand. We have answered many questions. You have not. We have improved the performance of many apps. You have not. We know what our questions are. You do not. We have years of doing this. You do not.

    So its very simple. We know the routine. You do not. Dont take it personl. Its just the way it is. You are learning... so are we!

    But its your question not ours. You need to do what it takes to get your answer. If that means copying your stuff a few times then you need to do it. Thats what it takes for you to get your question answered. Thats all. Its up to you. Not us.

    And we make mistakes so you need to quide us to your question and answer. Not the other way around.

    :)


    Hi Tommy,

    Thanks for declaration but when you tried to ask me about my DB and my app. and you tell me that you don't want to learn my app. i felt that you (insulted me)so i was angry and i told you that i didn't tell you about any thing. Accept my apologize Tommy ...you are the expert and i'm the beginner 

    Regards from Amr_Aly



    • Edited by Amr_Aly Thursday, October 19, 2017 1:47 PM
    Thursday, October 19, 2017 1:42 PM

  • Hi Tommy,

    Thanks for declaration but when you tried to ask me about my DB and my app. and you tell me that you don't want to learn my app. i felt that you (insulted me)so i was angry and i told you that i didn't tell you about any thing. Accept my apologize Tommy ...you are the expert and i'm the beginner 

    Regards from Amr_Aly



    Yes I understand. In fact for an instant I was angry at you for saying it. Then I calmed down and figured I had insulted you although that was not my intent.

    That's why we need to be clear. We develop a give and take vocabulary. We have done it already many times.

    You are young I am old. I have been around the block many times. You not so many (I assume, could be wrong).

    A prophet once said that when our partner does something we find unattractive, we tend to become angry and we try to use anger to change our partner. But anger never works.

    A better way is to accept things as they are. Then tell our feelings.

    That's what we are doing now, telling our feelings.

    But the bottom line is that it is your project not mine.

    Thursday, October 19, 2017 2:10 PM
  • Then you should create a constructor for that second form so that you can pass in the ID of the patient when the form is created, and the form constructor can access the details and populate the form controls as the form is created.  Where is the patient ID - is it txtNo.Text?  The code would look something like

    Sub GotoVisitPH()
            Dim ThisForm2 as New frm2(txtNo.Text)
            ThisForm2.Show  
            Me.Hide()
    End Sub

    so you could then move the form initialize code into the constructor of that second form, where it belongs.  See: https://vbdotnetblog.wordpress.com/forms/97-2/ for an example of passing a value to a constructor.

    Posting images is not usually helpful - what is needed is the code you are actually using posted in this thread.

    OK,

    After testing i found that when removing timer i can to go to second form(form2 by clicking on the visits button) but only when (no Patient name in the combo box) and in case of (existence of name in the combo box and press visits button) this ugly error occur ( " Object Reference Not Set To An Instance Of An Object " ) appear again and pointed to (f2.ShowAttachTable()) and when i commented it the error appear with (f2.ShowInvTable()) and when commented it the error occur with (f2.ShowVisitsTable()). This is code of the visits button

     Private Sub btnVisits_Click(sender As Object, e As EventArgs) Handles btnVisits.Click
            Trace.WriteLine("btnVisits_Click STARTED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
    
            If cbxPatName.Text <> "" And txtNo.Text = GetAutonumber("Pat", "Patient_no") Then
                GotoVisitPH()
            ElseIf cbxPatName.Text <> "" And txtNo.Text <> GetAutonumber("Pat", "Patient_no") Then
                GotoVisitPH()
                f2.ShowAttachTable()
                f2.ShowInvTable()
                f2.ShowVisitsTable()
                f2.ShowVisDPTable()
    
            Else
                GotoVisitPH()
                'f2.txtVisPatNo.Text = ""
                'f2.btnNewVisit.Enabled = False
            End If
            Trace.WriteLine("btnVisits_Click FINISHED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
        End Sub

    The strange thing is ,In the second form(form2) i can go to (form1) when the name,patient id and visit no are exist and the data of tables of (form1) populated normally without any error .Code of patient button

    Private Sub btnPatient_Click(sender As Object, e As EventArgs) Handles btnPatient.Click
            Trace.WriteLine("btnPatient_Click STARTED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            If txtVisPatNo.Text <> "" And txtVisNo.Text = GetAutonumber("Visits", "Visit_no") Then
                GoToPatients()
                ShowPatientTable()
                frm1.txtNo.Select()
    
            ElseIf txtVisNo.Text <> GetAutonumber("Visits", "Visit_no") And txtVisName.Text <> "" Then
                GoToPatients()
                ShowPatientTable()
                frm1.ShowGynTable()
                frm1.ShowGyn2Table()
                frm1.txtNo.Select()
    
            ElseIf txtVisPatNo.Text = "" And txtVisName.Text = "" Then
                GoToPatients()
                frm1.txtNo.Select()
            End If
            Trace.WriteLine("btnPatient_Click FINISHED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
        End Sub
    Sub GoToPatients()
            Trace.WriteLine("GoToPatient STARTED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            
            frm1.Show()
            f2.Hide()
            frm1.ClearData()
    
            Trace.WriteLine("GoToPatient FINISHED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
        End Sub

    I'm confusing....

    Sub ShowAttachTable()
            Trace.WriteLine("ShowAttachTable STARTED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            Using con As New OleDbConnection("provider=microsoft.ace.oledb.12.0; data source=Dr_T.accdb")
                con.Open()
    
                Using cmd As New OleDbCommand
                    cmd.Connection = con
                    cmd.CommandText = "SELECT * FROM AtFile WHERE Visit_no=@Vis_no"
                    cmd.Parameters.AddWithValue("@Visit_no", txtVisNo.Text)
    
                    Using dt As New DataTable
                        dt.Load(cmd.ExecuteReader)
    
                        If dt.Rows.Count > 0 Then
                            txtVisPatNo.Text = dt.Rows(0).Item("Patient_no").ToString
    
                            txtVisNo.Text = dt.Rows(0).Item("Visit_no").ToString
    
                            txtAtt1.Text = dt.Rows(0).Item("LB1").ToString
    
                            txtCo1.Text = dt.Rows(0).Item("Co1").ToString
    
                            txtAtt2.Text = dt.Rows(0).Item("LB2").ToString
    
                            txtCo2.Text = dt.Rows(0).Item("Co2").ToString
    
                            txtAtt3.Text = dt.Rows(0).Item("LB3").ToString
    
                            txtCo3.Text = dt.Rows(0).Item("Co3").ToString
    
                            txtAtt4.Text = dt.Rows(0).Item("LB4").ToString
    
                            txtCo4.Text = dt.Rows(0).Item("Co4").ToString
    
                            txtAtt5.Text = dt.Rows(0).Item("LB5").ToString
    
                            txtCo5.Text = dt.Rows(0).Item("Co5").ToString
    
                            DTPickerAtt.Text = dt.Rows(0).Item("AttDate").ToString
                        End If
    
                    End Using
                End Using
            End Using
            Trace.WriteLine("ShowAttachTable FINISHED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
        End Sub
    Sub ShowGynTable()
            Using con As New OleDbConnection("provider=microsoft.ace.oledb.12.0; data source=Dr_T.accdb")
                con.Open()
                Using cmd As New OleDbCommand
                    cmd.Connection = con
    
                    cmd.CommandText = "select * from Gyn where Patient_no=@Patient_no" '& dgvPatients.CurrentRow.Cells(0).Value
                    cmd.Parameters.AddWithValue("@Patient_no", txtNo.Text)
                    Using dt As New DataTable
                        dt.Load(cmd.ExecuteReader)
                        If dt.Rows.Count > 0 Then
                            txtNo.Text = dt.Rows(0).Item("Patient_no").ToString
                            txtG.Text = dt.Rows(0).Item("G").ToString
                            txtP.Text = dt.Rows(0).Item("P").ToString
                            txtA.Text = dt.Rows(0).Item("A").ToString
                            cbxHPOC.Text = dt.Rows(0).Item("HPOC").ToString
                            cbxLD.Text = dt.Rows(0).Item("LD").ToString
                            cbxLC.Text = dt.Rows(0).Item("LC").ToString
                            DTPickerMns.Text = dt.Rows(0).Item("MNSDate").ToString
                            DTPickerLMP.Text = dt.Rows(0).Item("LMPDate").ToString
                            DTPickerEDD.Text = dt.Rows(0).Item("EDDDate").ToString
                            txtElapsed.Text = dt.Rows(0).Item("ElapW").ToString
                            txtGA.Text = dt.Rows(0).Item("GAW").ToString
                            cbxMedH1.Text = dt.Rows(0).Item("MedH1").ToString
                            cbxMedH2.Text = dt.Rows(0).Item("MedH2").ToString
                            cbxMedH3.Text = dt.Rows(0).Item("MedH3").ToString
                            cbxSurH1.Text = dt.Rows(0).Item("SurH1").ToString
                            cbxSurH2.Text = dt.Rows(0).Item("SurH2").ToString
                            cbxSurH3.Text = dt.Rows(0).Item("SurH3").ToString
                            cbxGynH1.Text = dt.Rows(0).Item("GynH1").ToString
                            cbxGynH2.Text = dt.Rows(0).Item("GynH2").ToString
                            cbxGynH3.Text = dt.Rows(0).Item("GynH3").ToString
                            cbxDrugH1.Text = dt.Rows(0).Item("DrugH1").ToString
                            cbxDrugH2.Text = dt.Rows(0).Item("DrugH2").ToString
                            cbxDrugH3.Text = dt.Rows(0).Item("DrugH3").ToString
                        End If
                    End Using
                End Using
            End Using
            
        End Sub

    Thanks in advance Acamar


    Thursday, October 19, 2017 6:20 PM
  • Ah, i want go to the second form with the same name of patient and with the ID number(Patient No)

    What form is frm2 being opened from?   F1.Hide() does not look correct to me.

    That constructor code does not follow the format that I referred to.  It should be something like:

    Public Sub New(S As String, N As String)
            InitializeComponent()
            Trace.WriteLine("New STARTED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            txtVisName.Text = S
            txtVisPatNo.Text = N
            ds = New DataSet
            da = New OleDbDataAdapter("SELECT * FROM Visits ORDER BY Visit_no", conn)
            da.Fill(ds, "Visits")
            dgvVisit.DataSource = ds.Tables("Visits")
            ds1 = New DataSet
            da1 = New OleDbDataAdapter("SELECT * FROM Inves", conn)
            da1.Fill(ds1, "Inves")
            dgvInv.DataSource = ds1.Tables("Inves")
            ds2 = New DataSet
            da2 = New OleDbDataAdapter("select * from AtFile", conn)
            da2.Fill(ds2, "AtFile")
            dgvAtt.DataSource = ds2.Tables("AtFile")
            f2.SuspendLayout()
            f2.Visible = True
            f2.ResumeLayout()
            Trace.WriteLine("New FINISHED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
        End Sub

    but you seem to be using a lot of variables before you have declared them.  That includes ds, da, ds1, da1, ds2 and da2.    If you report an error message you must indicate the line of code at which the error occurred and the values of the variables referred to in that code.  However, I suspect the error will be due to the failure to declare those variables.

    Do not include optional parameters in the constructor.  If you want a form of the constructor that takes a different parameter list then create an overload. I suspect you also need to pass conn in the constructor (or re-create it).


    • Edited by Acamar Thursday, October 19, 2017 8:47 PM fmt
    Thursday, October 19, 2017 7:35 PM

  • What form is frm2 being opened from?   F1.Hide() does not look correct to me.

    That constructor code does not follow the format that I referred to.  It should be something like:

    Public Sub New(S As String = "", N As String = "")
            InitializeComponent()
            Trace.WriteLine("New STARTED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            txtVisName.Text = S
            txtVisPatNo.Text = N
            ds = New DataSet
            da = New OleDbDataAdapter("SELECT * FROM Visits ORDER BY Visit_no", conn)
            da.Fill(ds, "Visits")
            dgvVisit.DataSource = ds.Tables("Visits")
            ds1 = New DataSet
            da1 = New OleDbDataAdapter("SELECT * FROM Inves", conn)
            da1.Fill(ds1, "Inves")
            dgvInv.DataSource = ds1.Tables("Inves")
            ds2 = New DataSet
            da2 = New OleDbDataAdapter("select * from AtFile", conn)
            da2.Fill(ds2, "AtFile")
            dgvAtt.DataSource = ds2.Tables("AtFile")
            f2.SuspendLayout()
            f2.Visible = True
            f2.ResumeLayout()
            Trace.WriteLine("New FINISHED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
        End Sub

    but you seem to be using a lot of variables before you have declared them.  That includes ds, da, ds1, da1, ds2 and da2.    If you report an error message you must indicate the line of code at which the error occurred and the values of the variables referred to in that code.  However, I suspect the error will be due to the failure to declare those variables.

    Do not include optional parameters in the constructor.  If you want a form of the constructor that takes a different parameter list then create an overload. I suspect you also need to pass conn in the constructor (or re-create it).

    Excuse me sir,

    form1 = frm1 = f1 and form2 = frm2 = f2 this is my fault.......the error here

    By the way i followed your instructions and the same error . How to pass conn in the constructor ?
    • Edited by Amr_Aly Thursday, October 19, 2017 8:19 PM
    Thursday, October 19, 2017 8:13 PM
  • form1 = frm1 = f1 and form2 = frm2 = f2

    But which form is this code
        f1.Hide()
    being executed in?   If it's being executed in frm1 then it must be
        Me.Hide()

    because f1 is an instance of frm1.

    How to pass conn in the constructor ?

    Add it to the argument list in the constructor signature for form 2:
           Public Sub New(S As String, N As String, conn As OleDbConnection)
    then include it in the method call
            Dim ThisForm2 as New frm2(txtNo.Text, txtId.text, conn)

    You might need to assign it to a globel variable in form 2, as presumably it is used in methods other than the constructor.

    The errors you are seeing are occurring because you are trying to update controls on form 2 from code in form 1.   Any code that updates controls on form 2 should be part of the code of form 2, not form 1.

    Thursday, October 19, 2017 8:47 PM
  • form1 = frm1 = f1 and form2 = frm2 = f2

    But which form is this code
        f1.Hide()
    being executed in?   If it's being executed in frm1 then it must be
        Me.Hide()

    because f1 is an instance of frm1.

    How to pass conn in the constructor ?

    Add it to the argument list in the constructor signature for form 2:
           Public Sub New(S As String, N As String, conn As OleDbConnection)
    then include it in the method call
            Dim ThisForm2 as New frm2(txtNo.Text, txtId.text, conn)

    You might need to assign it to a globel variable in form 2, as presumably it is used in methods other than the constructor.

    The errors you are seeing are occurring because you are trying to update controls on form 2 from code in form 1.   Any code that updates controls on form 2 should be part of the code of form 2, not form 1.

    The same problem sir , I followed the instructions and assigned conn as a global variable in form2

    but the same problem occured

    Imports System.Data.OleDb
    Imports System.IO
    Imports System.Xml
    Imports System.DateTime
    Imports System.Windows.Forms
    Imports System.Management
    Imports System.Threading
    
    Public Class frm2
    
        'Inherits System.Windows.Forms.Form
    
        Dim conn As New OleDbConnection("provider=microsoft.ace.oledb.12.0; data source=Dr_T.accdb")
        Dim cmd As New OleDbCommand
        Dim da As New OleDbDataAdapter
        Dim da1 As New OleDbDataAdapter
        Dim da2 As New OleDbDataAdapter
        Dim ds As New DataSet
        Dim ds1 As New DataSet
        Dim ds2 As New DataSet
        Dim ds3 As New DataSet
        'Dim dv As New DataView
        'Private BS As New BindingSource
        Dim dt As New DataTable
        Friend f2 As frm2 = Me
        'Friend f1 As New frm1
        'Dim sb As New Text.StringBuilder()
    
        Public Sub New(S As String, N As String, conn As OleDbConnection)
            MyBase.New()
            Trace.WriteLine("New STARTED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            'Application.EnableVisualStyles()
            'Application.DoEvents()
            'This call is required by the Windows Form Designer.
            InitializeComponent()
            'Add any initialization after the InitializeComponent() call
            txtVisName.Text = S
            txtVisPatNo.Text = N
            'cmd.Connection = conn
    
            ds = New DataSet
            da = New OleDbDataAdapter("SELECT * FROM Visits ORDER BY Visit_no", conn)
            da.Fill(ds, "Visits")
            dgvVisit.DataSource = ds.Tables("Visits")
            ''''''''''''''''''''''''''''
            ds1 = New DataSet
            da = New OleDbDataAdapter("SELECT * FROM VisitDP", conn)
            da.Fill(ds1, "VisitDP")
            dgvDrug.DataSource = ds1.Tables("VisitDP")
            '''''''''''''''''''''''''''''''''''
            ds2 = New DataSet
            da = New OleDbDataAdapter("SELECT * FROM Inves", conn)
            da.Fill(ds2, "Inves")
            dgvInv.DataSource = ds2.Tables("Inves")
            ''''''''''''''''''''''''''''
            ds3 = New DataSet
            da = New OleDbDataAdapter("select * from AtFile", conn)
            da.Fill(ds3, "AtFile")
            dgvAtt.DataSource = ds3.Tables("AtFile")
            ''''''''''''''''''''''''''''
            'f2.SuspendLayout()
            'f2.Visible = True
            'f2.ResumeLayout()
            Trace.WriteLine("New FINISHED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
        End Sub

    I spent all time till now testing ,but without benefit .I knew that the answer exists in your last two lines

    The errors you are seeing are occurring because you are trying to update controls on form 2 from code in form 1.   Any code that updates controls on form 2 should be part of the code of form 2, not form 1.

    So i gave to me chance to find the error myself but i failed .........excuse me sir 

    Thursday, October 19, 2017 10:56 PM
  • The same problem sir , I followed the instructions and assigned conn as a global variable in form2

    You have created a global variable called 'conn' and instantiated it as new connection.  If you want to do it that way (which is quite suitable) then you do not pass it in the constructor.  You only need the one connection - if you create it in form 2 then there is no need to pass it from form 1. 

    'Same problem' is not a useful description.  What is the error, what line of code does it occur at, and what are the values of the variables in that line of code?

    Which form is this code 
         f1.Hide()
    being executed in?   If it's being executed in frm1 then it must be
        Me.Hide()

    because f1 is an instance of frm1.

    Why have tou added MyBase.New() to the constructor?

    Thursday, October 19, 2017 11:21 PM
  • The same problem sir , I followed the instructions and assigned conn as a global variable in form2

    You have created a global variable called 'conn' and instantiated it as new connection.  If you want to do it that way (which is quite suitable) then you do not pass it in the constructor.  You only need the one connection - if you create it in form 2 then there is no need to pass it from form 1. 

    'Same problem' is not a useful description.  What is the error, what line of code does it occur at, and what are the values of the variables in that line of code?

    Which form is this code 
         f1.Hide()
    being executed in?   If it's being executed in frm1 then it must be
        Me.Hide()

    because f1 is an instance of frm1.

    Why have tou added MyBase.New() to the constructor?

     Sub GotoVisitPH()
            Trace.WriteLine("GotoVisitPH started @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            Dim f2 As New frm2(cbxPatName.Text, txtNo.Text)
            f2.Show()
            Me.Hide()   
    
            f2.ClearData()
            f2.ClearDrug()
            f2.txtComplain.Text = "" : f2.txtSign.Text = "" : f2.txtDiagnosis.Text = ""
            f2.txtIntervention.Text = "" : f2.txtAmount.Text = ""
    
            f2.txtVisNo.Text = GetAutonumber("Visits", "Visit_no")
            
            Trace.WriteLine("GotoVisitPH before RunCommand @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            RunCommand("UPDATE Visits Set Name='" & cbxPatName.Text & "' WHERE Patient_no=" & txtNo.Text)
            Trace.WriteLine("GotoVisitPH before Fill_Visits @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            f2.Fill_Visits()
            Trace.WriteLine("GotoVisitPH FINISHED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
        End Sub


    Thursday, October 19, 2017 11:39 PM
  • The same problem sir , I followed the instructions and assigned conn as a global variable in form2

    You have not shown the values of the variables in that line.  That would have demonstrated the problem immediately.

    That code is in Form 1.  It is updating controls on form 2.  That will be difficult to make work.

    If you want to do it like that you need to declare f2 at the form level (not in GotoVisitPH).  That way, when you instantiate it in GotoVisitPH it will set the form level variable to a value, and the code in btnVisits_Click will work.  That is a very poor solution.

    It's not clear why clicking a button on Form 1 would update information on form 2.  That information should already be on that form when it is created.   The best solution is to move the code that updates form 2 out of that button click event handler and place it in the constructor of form 2, in exactly the same way that the initialisation code in GotoVisitPH is now in the constructor for form 2.

    Friday, October 20, 2017 12:29 AM

  • You have not shown the values of the variables in that line.  That would have demonstrated the problem immediately.

    That code is in Form 1.  It is updating controls on form 2.  That will be difficult to make work.

    If you want to do it like that you need to declare f2 at the form level (not in GotoVisitPH).  That way, when you instantiate it in GotoVisitPH it will set the form level variable to a value, and the code in btnVisits_Click will work.  That is a very poor solution.

    It's not clear why clicking a button on Form 1 would update information on form 2.  That information should already be on that form when it is created.   The best solution is to move the code that updates form 2 out of that button click event handler and place it in the constructor of form 2, in exactly the same way that the initialisation code in GotoVisitPH is now in the constructor for form 2.

    First i want to thank you sir for your time and efforts, But i have some inquiries 

    1- When i moved this snippet of code out of button visits click the error disappear

                'f2.ShowAttachTable()
                'f2.ShowInvTable()
                'f2.ShowVisitsTable()
                'f2.ShowVisDPTable()
     

    And now i can transfer to form2 but without the (patient name)and(patient id) i think the constuctor doesn't work.But when i put these 2 lines i can transfer to form2

             f2.txtVisPatNo.Text = txtNo.Text
             f2.txtVisName.Text = cbxPatName.Text

    2- Update patient name in the form 2 was performed when ("Timer.start")was existed but now i cant perform it (the patient in my app has one id (Patient_no) so when the user updates the (patient name)in the form1, it must when transfer to form 2 the names update also) this code responsible to do this task

            Sub GotoVisitPH()
            Trace.WriteLine("GotoVisitPH started @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            Dim f2 As New frm2(cbxPatName.Text, txtNo.Text)
            f2.Show()
            Me.Hide()
            'Timer1.Start()
    
            f2.ClearData()
            f2.ClearDrug()
            f2.txtComplain.Text = "" : f2.txtSign.Text = "" : f2.txtDiagnosis.Text = ""
            f2.txtIntervention.Text = "" : f2.txtAmount.Text = ""
    
            f2.txtVisNo.Text = GetAutonumber("Visits", "Visit_no")
            'f2.txtVisPatNo.Text = txtNo.Text
            'f2.txtVisName.Text = cbxPatName.Text
    
          ''This code for update name in the form 2
           cmd = New OleDbCommand("UPDATE Visits Set Name=@Name WHERE Patient_no=@Patient_no", conn)
            cmd.Parameters.AddWithValue("@Name", cbxPatName.Text)
            cmd.Parameters.AddWithValue("@Patient_no", txtNo.Text)
            f2.Fill_Visits()
            Trace.WriteLine("GotoVisitPH FINISHED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
          End Sub
    3- Form2 is very very slow, Slowing issue is more than before

    Thanks in advance sir , We appreciated your time and efforts





    • Edited by Amr_Aly Friday, October 20, 2017 2:49 PM
    Friday, October 20, 2017 11:34 AM
  • First i want to thank you sir for your time and efforts, But i have some inquiries 

    1- When i moved this snippet of code out of button visits click the error disappear

                'f2.ShowAttachTable()
                'f2.ShowInvTable()
                'f2.ShowVisitsTable()
                'f2.ShowVisDPTable()

    And now i can transfer to form2 but without the (patient name)and(patient id) i think the constuctor doesn't work.But when i put these 2 lines i can transfer to form2

             f2.txtVisPatNo.Text = txtNo.Text
             f2.txtVisName.Text = cbxPatName.Text

    2- Update patient name in the form 2 was performed when ("Timer.start")was existed but now i cant perform it (the patient in my app has one id (Patient_no) so when the user updates the (patient name)in the form1, it must when transfer to form 2 the names update also) this code responsible to do this task

            Sub GotoVisitPH()
            Trace.WriteLine("GotoVisitPH started @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            Dim f2 As New frm2(cbxPatName.Text, txtNo.Text)
            f2.Show()
            Me.Hide()
            'Timer1.Start()
    
            f2.ClearData()
            f2.ClearDrug()
            f2.txtComplain.Text = "" : f2.txtSign.Text = "" : f2.txtDiagnosis.Text = ""
            f2.txtIntervention.Text = "" : f2.txtAmount.Text = ""
    
            f2.txtVisNo.Text = GetAutonumber("Visits", "Visit_no")
            'f2.txtVisPatNo.Text = txtNo.Text
            'f2.txtVisName.Text = cbxPatName.Text
    
          ''This code for update name in the form 2
           cmd = New OleDbCommand("UPDATE Visits Set Name=@Name WHERE Patient_no=@Patient_no", conn)
            cmd.Parameters.AddWithValue("@Name", cbxPatName.Text)
            cmd.Parameters.AddWithValue("@Patient_no", txtNo.Text)
            f2.Fill_Visits()
            Trace.WriteLine("GotoVisitPH FINISHED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
          End Sub
    3- Form2 is very very slow, Slowing issue is more than before

    Thanks in advance sir , We appreciated your time and efforts

    Hi Mr Acamar,

    I've a good news ,Now I solved number (2) but with this code  

    RunCommand("UPDATE Visits SET Name='" + f2.txtVisName.Text + "' WHERE Patient_no=" + f2.txtVisPatNo.Text)
    Fill_Visits()

    We can cede number(1) for a while and we can focus on number(3)

    thanks sir ..................


    Friday, October 20, 2017 4:49 PM
  • And now i can transfer to form2 but without the (patient name)and(patient id) i think the constuctor doesn't work.

    You need to find out why passing those values in the constructor is not populating the f2 instance correctly.   You would do that by putting a breakpoint at the start of the constructor and stepping the initialization code through one line at a time, watching the values of the relevant variables as you go.

    2- Update patient name in the form 2 was performed when ("Timer.start")was existed but now i cant perform it (the patient in my app has one id (Patient_no) so when the user updates the (patient name)in the form1, it must when transfer to form 2 the names update also) this code responsible to do this task

    Do you mean that the user can change the patient ID while f2 is active, and the update must appear on form 2?   That seems unlikely given that you have hidden form 1 when you open f2.  But if that can happen, then you need to ensure that the code that executes in the constructor to initialise the data on form 2 from the value passed in the constructor is moved out into its own public method.  That method is then called from the constructor (using the values passed as the arguments) and is also called from form 1 code when the user changes the patient id in form 1 (passing the new ID).   That requires that variable f2 is declared at the form level.

    If it is not possible to alter the patient ID while f2 is active then you issue you describe is fixed when the constructor operates properly.

    3- Form2 is very very slow, Slowing issue is more than before

    Not sure how you know this if the constructor is not working correctly.  I would recommend fixing the existing problem before looking at the response times again.

    Friday, October 20, 2017 8:08 PM
  • You need to find out why passing those values in the constructor is not populating the f2 instance correctly.   You would do that by putting a breakpoint at the start of the constructor and stepping the initialization code through one line at a time, watching the values of the relevant variables as you go.

    Do you mean that the user can change the patient ID while f2 is active, and the update must appear on form 2?   That seems unlikely given that you have hidden form 1 when you open f2.  But if that can happen, then you need to ensure that the code that executes in the constructor to initialise the data on form 2 from the value passed in the constructor is moved out into its own public method.  That method is then called from the constructor (using the values passed as the arguments) and is also called from form 1 code when the user changes the patient id in form 1 (passing the new ID).   That requires that variable f2 is declared at the form level.

    If it is not possible to alter the patient ID while f2 is active then you issue you describe is fixed when the constructor operates properly.

    Not sure how you know this if the constructor is not working correctly.  I would recommend fixing the existing problem before looking at the response times again.

    Hi Mr Acamar,

    The user can't change the (Patient id),The (patient name) only that the user can update it .The user makes update on the name in the form1 then go to form2 (must find this name that has been updated in form 1 changed in form 2 like form 1 exactly) i.e (we have in form 1 patient name "Jon Eric Soto" with (patient id = 8) updated to "Jon Eric Solou" with the same (patient id = 8) in form 1) we must transfer to form 2 with this (patient name "Jon Eric Solou" and (patient id = 8))...........

    My code is still like that , when i put the break point every thing is ok...

    but how can i "watching the values of the relevant variables "...  this is the line that i put the break point once in front of

    f2 = New frm2(cbxPatName.text, txtNo.text)

    Public Sub New(N As String, N As String)

    I think by step over when i use it , the yellow marker go to the second line   

    Option Strict On
    'Option Explicit On
    'Option Infer Off
    Imports System.Data.OleDb
    Imports System.IO
    Imports System.Timers
    Imports System.DateTime
    Imports System.Xml
    Imports System.Management
    Imports System.Windows.Forms
    Imports System.Configuration
    Imports System.Threading
    
    Public Class frm1
    
        'Inherits System.Windows.Forms.Form
    
        Friend f1 As frm1
        Dim f2 As frm2    '(cbxPatName.Text, txtNo.Text)
    
        Dim conn As New OleDbConnection("provider=microsoft.ace.oledb.12.0; data source=Dr_T.accdb")

    Public Class frm2
    
        'Inherits System.Windows.Forms.Form
    
        Dim conn As New OleDbConnection("provider=microsoft.ace.oledb.12.0; data source=Dr_T.accdb")
        Dim cmd As New OleDbCommand
        Dim da As New OleDbDataAdapter
        Dim da1 As New OleDbDataAdapter
        Dim da2 As New OleDbDataAdapter
        Dim ds As New DataSet
        Dim ds1 As New DataSet
     
        Friend f2 As frm2
        'Friend f1 As New frm1
        'Dim sb As New Text.StringBuilder()
    
        Public Sub New(S As String, N As String)
            'MyBase.New()
            Trace.WriteLine("New STARTED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
    
            'This call is required by the Windows Form Designer.
            InitializeComponent()
            'Add any initialization after the InitializeComponent() call
            'S = txtVisName.Text
            'N = txtVisPatNo.Text
            txtVisName.Text = S
            txtVisPatNo.Text = N






    • Edited by Amr_Aly Friday, October 20, 2017 10:49 PM
    Friday, October 20, 2017 10:21 PM
  • I've a good news ,Now I solved number (2) but with this code  

    RunCommand("UPDATE Visits SET Name='" + f2.txtVisName.Text + "' WHERE Patient_no=" + f2.txtVisPatNo.Text)
    Fill_Visits()

    You should not be accessing controls on form 2 from code in form 1.   If you have to access or update something on form 2 from another form then create a form 2 method that does the update, and call that method from that other form.

    Saturday, October 21, 2017 12:03 AM
  • The user can't change the (Patient id),The (patient name) only that the user can update it .The user makes update on the name in the form1 then go to form2 (must find this name that has been updated in form 1 changed in form 2 like form 1 exactly) i.e (we have in form 1 patient name "Jon Eric Soto" with (patient id = 8) updated to "Jon Eric Solou" with the same (patient id = 8) in form 1) we must transfer to form 2 with this (patient name "Jon Eric Solou" and (patient id = 8)).

    That wasn't the question.   You need to decide whether the current patient can be changed in form 1 after form 2 is created.   If the patient can only be changed by closing form 2, changing the details on form 1, and creating a new form 2, then the patient details will only ever be created on form 2 in the constructor, and that makes things a bit simpler.   If the patient can be changed on form 1 after form 2 is created (and therefore the detail on form 2 needs to be changed), then you need a method on form 2 that populates that form with the new patient details,  and the constructor for form 2 will use that same method.  Because your code hides form 1 when form 2 is created, I think that you are using the first method only, which is a bit simpler.

    but how can i "watching the values of the relevant variables ".  this is the line that i put the break point once in front of f2 = New frm2(cbxPatName.text, txtNo.text)

    You can put the break point there, or at the first line of the New method.  You watch variables by hovering the mouse over the variable name in code, or by adding a watch variable. See:
    https://vbdotnetblog.wordpress.com/overview/debugging/

    Saturday, October 21, 2017 12:16 AM
  • Hi :),

    Personally once I've finished with one of my newby applications, I read and review my code to check that the logic is correct (even if there are no errors, there are usually ways to optimize the code). Any unnecessary loops in the code will surely slow down the application.

    You can also turn on option strict and explicit, This basically ensures that any bugs in the code are identified and fixed more easily.

    Saturday, October 21, 2017 3:26 PM
  • You should not be accessing controls on form 2 from code in form 1.   If you have to access or update something on form 2 from another form then create a form 2 method that does the update, and call that method from that other form.

    Thanks Mr Acamar,

    Again Some good news sir ,First one that you are a respectable man and really a good instructor 

    Second the constructor is working well now(I caught the problem) and now i can to transfer to the

    form 2 with (patient name)and(patient id) without any problem

    Third last post made me think how can i perform an update to the(patient name) i put this code in the form 2 _Shown event and every thing is good now.

    RunCommand("UPDATE Visits SET Name='" + txtVisName.Text + "' WHERE Patient_no=" & txtVisPatNo.Text)

    I knew that you will say that the parameterise is the right way than concatenate ,I'll do it but after i solve all problems in the form 2.

    Fourth Slowing issue :o)  It has been solved By (Removing some snippet of code) from the form_Load event and from (Sub New) in form 2 . These are the code that i commented it 

           'ds = New DataSet
            'da = New OleDbDataAdapter("SELECT * FROM Visits ORDER BY Visit_no", conn)
            'da.Fill(ds, "Visits")
            'dgvVisit.DataSource = ds.Tables("Visits")
            '''''''''''''''''''''''''''''
            'ds1 = New DataSet
            'da = New OleDbDataAdapter("SELECT * FROM VisitDP", conn)
            'da.Fill(ds1, "VisitDP")
            'dgvDrug.DataSource = ds1.Tables("VisitDP")
            ''''''''''''''''''''''''''''''''''''
            'ds2 = New DataSet
            'da = New OleDbDataAdapter("SELECT * FROM Inves", conn)
            'da.Fill(ds2, "Inves")
            'dgvInv.DataSource = ds2.Tables("Inves")
            '''''''''''''''''''''''''''''
            'ds3 = New DataSet
            'da = New OleDbDataAdapter("select * from AtFile", conn)
            'da.Fill(ds3, "AtFile")
            'dgvAtt.DataSource = ds3.Tables("AtFile")
          
     

    I think loading of 4 tables make some heavy load on the App. , Also i get rid of table adapter and dataset created by the designer , And this make my App. is more efficient than before.

    Fifth remain one thing about performance (But this issue up to you sir if you want to continue in this thread or i have to open another new thread)

    My combo boxes in the two forms load lists from (XML files) So i have code for save in xml file and load from xml file and remove duplicate from xml file.................

    I think it is a long issue so i have to open a new question......

    But in the end any suggestion sir or you see any code problem in this post .

    Many thanks sir . Your time and efforts are apreciated

    Regards from Amr_Aly  

        


    • Edited by Amr_Aly Saturday, October 21, 2017 6:42 PM
    Saturday, October 21, 2017 4:57 PM
  • Hi :),

    Personally once I've finished with one of my newby applications, I read and review my code to check that the logic is correct (even if there are no errors, there are usually ways to optimize the code). Any unnecessary loops in the code will surely slow down the application.

    You can also turn on option strict and explicit, This basically ensures that any bugs in the code are identified and fixed more easily.

    Thanks Arrd ,

    It's a good idea .Really i have some loops and i intended to get rid of it 

    Thank you,

    Saturday, October 21, 2017 6:03 PM
  • Thanks Karen,

    I appreciate your time and efforts , My slowing issue is solved by deleting some code snippets that's all.

    I'm pleased that someone like you try to help me and guide me to the right way.

    many thanks Karen    

    Regards from Amr_Aly

    Saturday, October 21, 2017 6:19 PM
  • Thanks Frank ,

    My slowing issue is solved by deleting some code snippets .

    Mr Acamar guide me to the right way 

    see you soon in another thread Frank

    Regards from Amr_Aly

     

    Saturday, October 21, 2017 7:23 PM
  • I think loading of 4 tables make some heavy load on the App. , Also i get rid of table adapter and dataset created by the designer , And this make my App. is more efficient than before.    

    This code might indicate a problem:

    Public Class frm1
    
        Friend f1 As frm1
        Dim f2 As frm2    '(cbxPatName.Text, txtNo.Text)
    
    

    If you at using that because you want to do something like:

        Me.Hide()
        f1.Show()

    That won't work unless you are setting f1 to refer to the form 1 instance that you started with, see:
    https://vbdotnetblog.wordpress.com/forms/where-did-i-come-from/

    In your case you are not trying to access controls on f1, but you need f1 to be set to the instance of the form that created form 2, so you can do code like f1.Show().

    Saturday, October 21, 2017 9:27 PM
  • I think loading of 4 tables make some heavy load on the App. , Also i get rid of table adapter and dataset created by the designer , And this make my App. is more efficient than before.    

    This code might indicate a problem:

    Public Class frm1
    
        Friend f1 As frm1
        Dim f2 As frm2    '(cbxPatName.Text, txtNo.Text)
    

    If you at using that because you want to do something like:

        Me.Hide()
        f1.Show()

    That won't work unless you are setting f1 to refer to the form 1 instance that you started with, see:
    https://vbdotnetblog.wordpress.com/forms/where-did-i-come-from/

    In your case you are not trying to access controls on f1, but you need f1 to be set to the instance of the form that created form 2, so you can do code like f1.Show().

    Thanks Mr Acamar, 

    It's a useful article,I've an inquiry about constructor .How can i pass a (Sub)like (ShowAttachTable()) with the constructor Or more than one (Sub)?

     Sub ShowAttachTable()
            Trace.WriteLine("ShowAttachTable STARTED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
            Using con As New OleDbConnection("provider=microsoft.ace.oledb.12.0; data source=Dr_T.accdb")
                con.Open()
    
                Using cmd As New OleDbCommand
                    cmd.Connection = con
                    cmd.CommandText = "SELECT * FROM AtFile WHERE Visit_no=@Vis_no"
                    cmd.Parameters.AddWithValue("@Visit_no", txtVisNo.Text)
    
                    Using dt As New DataTable
                        dt.Load(cmd.ExecuteReader)
    
                        If dt.Rows.Count > 0 Then
                            txtVisPatNo.Text = dt.Rows(0).Item("Patient_no").ToString
    
                            txtVisNo.Text = dt.Rows(0).Item("Visit_no").ToString
    
                            txtAtt1.Text = dt.Rows(0).Item("LB1").ToString
    
                            txtCo1.Text = dt.Rows(0).Item("Co1").ToString
    
                            txtAtt2.Text = dt.Rows(0).Item("LB2").ToString
    
                            txtCo2.Text = dt.Rows(0).Item("Co2").ToString
    
                            txtAtt3.Text = dt.Rows(0).Item("LB3").ToString
    
                            txtCo3.Text = dt.Rows(0).Item("Co3").ToString
    
                            txtAtt4.Text = dt.Rows(0).Item("LB4").ToString
    
                            txtCo4.Text = dt.Rows(0).Item("Co4").ToString
    
                            txtAtt5.Text = dt.Rows(0).Item("LB5").ToString
    
                            txtCo5.Text = dt.Rows(0).Item("Co5").ToString
    
                            DTPickerAtt.Text = dt.Rows(0).Item("AttDate").ToString
                        End If
    
                    End Using
                End Using
            End Using
            Trace.WriteLine("ShowAttachTable FINISHED @ " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
        End Sub

    Thanks in advance sir 

    Sunday, October 22, 2017 11:50 AM
  • How can i pass a (Sub)like (ShowAttachTable()) with the constructor 

    You should explain why you would want to pass a sub to another form, because it's unlikely that you really want to do that.

    If you have a reference to a form instance in a variable (like the variable f2 in form 1 which is being set to refer to the instance of form 2 that you are creating) then you can call any public method on that form using that variable to qualify the method name.  Eg

    Public Class frm1
    
    ...
    
        Dim f2 As New frm2(cbxPatName.Text, txtNo.Text)
        f2.Show
        f2.ShowAttachTable()

    But of course it would be much simpler to execute ShowAttchTable when form 2 is created (like the code you already have in the form 2 Shown event).

    If you want a specific example then you will need to indicate which form contains the method ShowAttchTable and which form you intend to call it from.

    Sunday, October 22, 2017 9:00 PM
  • How can i pass a (Sub)like (ShowAttachTable()) with the constructor 

    You should explain why you would want to pass a sub to another form, because it's unlikely that you really want to do that.

    If you have a reference to a form instance in a variable (like the variable f2 in form 1 which is being set to refer to the instance of form 2 that you are creating) then you can call any public method on that form using that variable to qualify the method name.  Eg

    Public Class frm1
    
    ...
    
        Dim f2 As New frm2(cbxPatName.Text, txtNo.Text)
        f2.Show
        f2.ShowAttachTable()

    But of course it would be much simpler to execute ShowAttchTable when form 2 is created (like the code you already have in the form 2 Shown event).

    If you want a specific example then you will need to indicate which form contains the method ShowAttchTable and which form you intend to call it from.

    Many thanks Mr Acamar ,

    No doubt that you explain every thing and i am very happy that i have a new information about passing data ,

    My issue is solved and you guided me to the right way you are a good man and a good instructor 

    See you in another thread ,Thank you Mr Acamar


    Regards From Amr_Aly

    Sunday, October 22, 2017 9:38 PM
  • Thanks Frank ,

    My slowing issue is solved by deleting some code snippets .

    Mr Acamar guide me to the right way 

    see you soon in another thread Frank

    Regards from Amr_Aly

     

    Sorry for the delay in replying; I've been away.

    To the extent that I helped, you're certainly welcome. :)


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Sunday, October 22, 2017 10:50 PM