Results 1 to 3 of 3

Thread: ocx instance

  1. #1

    Thread Starter
    Addicted Member nihar's Avatar
    Join Date
    Jan 2002
    Location
    somewhere between home and office
    Posts
    234

    ocx instance

    hi,

    I have created an ocx which has a private integer variable called rcount.

    this ocx loads a form which has a datagrid displayed.
    In the datagrids gotfocus event i m reading this variable and positioning the grids row to that variable.
    I set the variable in the datagrids validate event.

    problem comes when i have more than one instance in the same form.
    like if i use it once and the count property is set to 4. in the next instance also it is being set to 4, whereas it should be the default i have set to 0. I want it to persist only for that instance so if there are more than one instance it should have its own variable value.

    what could be the reason?
    ciao,
    Nihar

    VB 6 Enterprise SP5;
    SQL Server 2000

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Is the variable declared in the control, or in a module?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Addicted Member nihar's Avatar
    Join Date
    Jan 2002
    Location
    somewhere between home and office
    Posts
    234
    Its a variable inside a form which is part of the usercontrol.
    This is text of another thread i posted on the general VB questions.
    it might make it more clearer.

    I m creating a user control which has a textbox (txtCall).
    In this project i have also added a form(frmGrid) which shows a grid.

    On a certain event of the txtCall i am showing this frmGrid; which shows the grid filled with some rows. Now the user selects a certain row and the form unloads return the value from the grid to txtCall.

    my problem is that i want to persist the row number such that the next time when the user calls frmGrid it should position to the previously called row.

    for this i have used a property of the usercontrol called rNum, which uses a private long variable to retain the value (lNum). now i want to access the property rNum in frmGrid so i can get and let the value.
    Last edited by nihar; Dec 8th, 2002 at 11:43 PM.
    ciao,
    Nihar

    VB 6 Enterprise SP5;
    SQL Server 2000

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