Results 1 to 10 of 10

Thread: Sub New Constructor probem? [Resolved}

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Sub New Constructor probem? [Resolved}

    Hi,

    In a project which seems to work O.K. I have designed forms which inherits from fclsAction.

    certain controls and code have been added to those derived forms and, subsequent to that, fclsAction has been amended.

    The project and the solution have been rebuilt.

    When I now attempt to view those derived forms in the design view, I am unable to do so and get the message

    "The ConnectionString property has not been properly initialised"

    I assume that this is something to do with the Public Sub New Constructor in the derived forms, yet they correspond exactly with the Sub New Constructor of the base class, as follows:

    VB Code:
    1. Public Sub New()
    2.         MyBase.New()
    3.  
    4.         'This call is required by the Windows Form Designer.
    5.         InitializeComponent()
    6.  
    7.         'Add any initialization after the InitializeComponent() call
    8.  
    9.     End Sub

    The connection is instanced in the general section of the Module as follows:

    VB Code:
    1. Public cnRankings As New OleDb.OleDbConnection

    and the connectionstring is set in a form which does not inherit from fclsAction, as follows:

    VB Code:
    1. Dim strDB1 As String
    2.         strDB1 = "Provider=Microsoft.Jet.oledb.4.0;data source =" & strDB
    3.         cnRankings.ConnectionString = strDB1
    4.         cnRankings.Open()

    StrDB contains the path & file selected in an OpenFileDialog box.

    Anyone have any suggestions please?
    Last edited by taxes; Feb 27th, 2004 at 05:09 PM.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  2. #2
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    Step through the code and find out on which line there is an error.. it usually helps in solving problems like this.. probably you are making things in the wrong order, or have forgotten something.. it becomes more obvious when you step


    kind regards
    Henrik

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi Henrik,

    "Step through the code and find out on which line there is an error.. it usually helps in solving problems like this.. probably you are making things in the wrong order, or have forgotten something.. it becomes more obvious when you step"


    The problem is the code works perfectly. There is no error during runtime.

    The error accurs in the design window when I try to obtain a design view of the derived forms.

    Or do you mean there is a method of stepping through that process?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  4. #4
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    Hey! Sorry I read your info a bit wrong, but on which line do you get that message? It sounds like you have an ADO.NET problem... but it is hard to tell without some more info...

    kind regards
    Henrik

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi Henrik,


    In the design environment, when I double click on one of the derived forms in the Solution Explorer window. I know of no way to find what line generates the error.

    Although I cannot get the form up in design view, I can get to the code view.
    Last edited by taxes; Feb 27th, 2004 at 05:33 AM.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  6. #6
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    I really wish I could help you further... but Im currently working mosthy with asp.net, only a little winforms... Im sure there are others here on the forum that are aces in winforms development...


    not the answer you wanted...

    kind regards
    Henrik

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi Henrik,

    Thanks for trying. Let us see what our USA friends have to say when they wake up.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    hi,

    I have experimented a little and found that the problem must be in the base form, as I can no longer derive a new form from it.

    I can create a derived form from other forms in the project (except from those derived from the problem form)

    I have assumed that the reference to "ConnectionString" in the error message

    "The ConnectionString property has not been properly initialised"

    refers to a database connection, but that is initialised in a module.


    Does "ConnectionString" have another meaning?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  9. #9
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Did the problem pop up after you changed the base class fclsAction? You may have to re-derive the sub classes in that case, even if on the surface it looks like it shouldn't affect them.

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    Many thanks for various suggestions. The problem is now solved. It was caused by an incorrect declaration of a dataadapter.
    What threw me was that in spite of the error, the programme ran perfectly. I just can't imagine why. I did not know dataadapters had a connection string! It is not in the intellisense.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width