dcsimg
Results 1 to 9 of 9

Thread: Method 'Text' of object 'IInkEdit' failed

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2010
    Posts
    420

    Method 'Text' of object 'IInkEdit' failed

    I have an InkEdit control array with only one instance of it placed on the form at design time, and then the rest of them loaded at runtime.
    After loading about 412 instances and showing something into their Text properties, the next instance fails to show the string, and instead, it issues a run-time error:
    Code:
    Run-time error: -2147467259
    Method 'Text' of object 'IInkEdit' failed
    Here is the code:
    Code:
    Private Sub Command1_Click()
       Dim i        As Long
       
       For i = 0 To 500
          txtFileNum.Text = "" & i
          
          If i > 0 Then
             Load txtFileName(i)
          End If
          
          txtFileName(i).Text = "Num " & i                 '  This line gives me the error
          txtFileName(i).Visible = True
          
       Next i
       
    End Sub
    I don't know why this happens. It is quite unexpected.
    How can I get around this?
    Thanks.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,234

    Re: Method 'Text' of object 'IInkEdit' failed

    Error code -2147467259 is also E_ACCESSDENIED.

    Out of curiosity, if you don't set the .Text property, do you still get the error? Thinking that the control may be blocking setting its text property until it is fully initialized, internally? Just a guess.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2010
    Posts
    420

    Re: Method 'Text' of object 'IInkEdit' failed

    Quote Originally Posted by LaVolpe View Post
    Error code -2147467259 is also E_ACCESSDENIED.

    Out of curiosity, if you don't set the .Text property, do you still get the error? Thinking that the control may be blocking setting its text property until it is fully initialized, internally? Just a guess.
    I commented out that line that sets the Text property of the InkEdit box. Also changed the loop to go through 2000 times instead of 500 times:
    Code:
    Private Sub Command1_Click()
       Dim i        As Long
       
       For i = 0 To 2000
          txtFileNum.Text = "" & i
          txtFileNum.Refresh
          
          If i > 0 Then
             Load txtFileName(i)
          End If
          
         'txtFileName(i).Text = "Num " & i                 '  This line gives me the error
          txtFileName(i).Visible = True
          
       Next i
       
    End Sub
    It no longer gives me that error.
    However, after the loop goes through 978 times, the program suddenly breaks (as if I had set a breakpoint).
    I have not set a break point, but it THINKS there is a break point on this line:
    Code:
             Load txtFileName(i)
    Very strange

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,234

    Re: Method 'Text' of object 'IInkEdit' failed

    What may appear strange to readers is the need for 500 to 2000 textbox like controls.

    Here's another test you can try. If it does not cause an error, then I'd say that error you got is a timing thing... The control needs time to setup internally before you can set the text. Maybe it also depends on what some of the control's property settings are too.

    Step 1. Run your initial loop to create 500 controls, without setting the text property
    Step 2. In another button, waiting a few seconds after all the controls are loaded.. See if it has same error
    Code:
       Dim i        As Long
       
       For i = 0 To txtFileName.UBound      
          txtFileName(i).Text = "Num " & i 
       Next i
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,312

    Re: Method 'Text' of object 'IInkEdit' failed

    Any RichEdit control is a pretty full-featured thing, more a yacht than a surfboard. Then add all of the infrastructure to accept and recognize ink strokes as text... this isn't something you want vast numbers of anyway.

    Are you sure you can't just use an MSHFlexGrid with one InkEdit control used as a marquee or data entry box? That would at least allow display and editing of Unicode text.

    Otherwise you'll probably want to build or buy a wrapped Unicode Edit control instead.

    There is a reason why this is seldom an issue for "real" programs. The vast majority have no need to try to span locales so ANSI works just fine.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2010
    Posts
    420

    Re: Method 'Text' of object 'IInkEdit' failed

    Quote Originally Posted by dilettante View Post
    Are you sure you can't just use an MSHFlexGrid with one InkEdit control used as a marquee or data entry box? That would at least allow display and editing of Unicode text.
    Each InkEdit box is to reside underneath a picturebox (showing the thumbnail of a file). The InkEdit is to display (for view and edit) the file name.
    Therefore a grid can't do the job.

    Thanks.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2010
    Posts
    420

    Re: Method 'Text' of object 'IInkEdit' failed

    Quote Originally Posted by LaVolpe View Post
    What may appear strange to readers is the need for 500 to 2000 textbox like controls.

    Here's another test you can try. If it does not cause an error, then I'd say that error you got is a timing thing... The control needs time to setup internally before you can set the text. Maybe it also depends on what some of the control's property settings are too.

    Step 1. Run your initial loop to create 500 controls, without setting the text property
    Step 2. In another button, waiting a few seconds after all the controls are loaded.. See if it has same error
    Code:
       Dim i        As Long
       
       For i = 0 To txtFileName.UBound      
          txtFileName(i).Text = "Num " & i 
       Next i
    I just changed the logic to use two separate commandbuttons: One to load 500 InkEdit boxes, and another to write something into them.
    I clicked on the first one.
    After the completion of the loading, I waited a minute, and then clicked on the second commandbutton.

    Result: Problem persists.
    I get the same error when the program attempts to write something into 437th InkEdit box.

    Thanks.
    Last edited by IliaPreston; Jul 21st, 2019 at 06:04 PM.

  8. #8
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,499

    Re: Method 'Text' of object 'IInkEdit' failed

    You need to create a virtual scroll port/display.
    Do not try to load all needed pictures in one go.
    Only load the images/controls which fit on the screen.
    If the user scrolls then refresh the images and text.

  9. #9
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,312

    Re: Method 'Text' of object 'IInkEdit' failed

    So skip using a grid.

    You can do the same thing other ways though. For example you might render your Unicode text into some sort of static control (PictureBox?) and when one of these gets focus hover a single InkEdit control over it to accept user editing of the contents.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width