Microsoft KB Archive/190477

= BUG: Run-time Error '326' with LoadResData =

Article ID: 190477

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q190477



SYMPTOMS
When loading an Icon from a resource file with LoadResData, you receive the following run-time error:

Run-Time error '326': Resource with identifier '101' not found

The LoadResData documentation states that it is possible to return an icon from a resource file in the form of a byte array. Doing so will result in the above error.



RESOLUTION
Use the LoadResPicture function to load an icon resource. For example,

Private Sub Form_Load Dim vMyIcon As Variant

vMyIcon = LoadResPicture(101,vbResIcon)

End Sub



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps to Reproduce Behavior
NOTE: These steps assume the Resource Editor is installed and available in Visual Basic from the Tools menu.

 Create a new Standard EXE project in Visual Basic. Form1 is created by default.  Paste the following code into the Form1's code window: Private Sub Form_Load Dim vMyIcon As Variant

vMyIcon = LoadResData(101, 3)

End Sub

 From the Tools menu, select the Resource Editor. Select the Add Icon option. Browse and select an icon to use. After selecting the icon, the Resource Editor should show an Icon resource with the id of '101'. Select the Save option on the Resource Editor. Save the Resource File as "TEST.RES". Once this is done, the Project Browser will show an additional folder called "Related Documents." This folder will contain the newly-created Resource File.</li> Press the F5 key to run the application. Note that the following error will occur:

Run-time error "326"; Resource with identifier '101' not found

</li></ol>

<div class="references_section">