VBAndCs / sVB-Small-Visual-Basic

Small Visual Basic (sVB) is an educational programming language, created by Eng. Mohammad Hamdy as an evolved version of Microsoft Small Basic (SB). It is meant to be easier and more powerful at the same time, to introduce programming basics to kids and beginners of any age, provided that they can use the English keyboard on the Windows OS.
Other
233 stars 16 forks source link

Version 3.0.9.3 fails to run my 3.0.8.4 project. #83

Closed dynamicboy closed 1 month ago

dynamicboy commented 1 month ago

My old project runs smoothly in version 3.0.8.4, but it keep throwing exceptions when I try to use version 3.0.9.x. The first excption I encountered with is "Object reference not set to an instance of an object." when I selected a combobox item which I added to the form by code. In OnSelection event, I remove all items and retrieve from database to fill it again.

In Debug Mode, TextWindows shows: LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found LDDataBase.GetDataBase: Database not found Press any key to close the window... LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found (I use AI to translate chinese characters to english)

In normal mode, database operation is OK.

VBAndCs commented 1 month ago

Add your external libraries to the bin folder of sVB. The new version path has changed and now exists in the C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3 folder


From: dynamicboy @.> Sent: Monday, September 9, 2024 8:58 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Subscribed @.***> Subject: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83)

My old project runs smoothly in version 3.0.8.4, but it keep throwing exceptions when I try to use version 3.0.9.x. The first excption I encountered with is "Object reference not set to an instance of an object." when I selected a combobox item which I added to the form by code. In OnSelection event, I remove all items and retrieve from database to fill it again.

In Debug Mode, TextWindows shows: LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found LDDataBase.GetDataBase: Database not found Press any key to close the window... LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found (I use AI to translate chinese characters to english)

In normal mode, database operation is OK.

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVTZCIVTRLIR4EO26KDZVYDZBAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43ASLTON2WKOZSGUYTIOJQHA2TCOA. You are receiving this because you are subscribed to this thread.

[https://s-install.avcdn.net/ipm/preview/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free.www.avast.comhttps://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail

dynamicboy commented 1 month ago

Add your external libraries to the bin folder of sVB. The new version path has changed and now exists in the C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3 folder ____ From: dynamicboy @.> Sent: Monday, September 9, 2024 8:58 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Subscribed @.***> Subject: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83) My old project runs smoothly in version 3.0.8.4, but it keep throwing exceptions when I try to use version 3.0.9.x. The first excption I encountered with is "Object reference not set to an instance of an object." when I selected a combobox item which I added to the form by code. In OnSelection event, I remove all items and retrieve from database to fill it again. In Debug Mode, TextWindows shows: LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found LDDataBase.GetDataBase: Database not found Press any key to close the window... LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found (I use AI to translate chinese characters to english) In normal mode, database operation is OK. — Reply to this email directly, view it on GitHub<#83>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVTZCIVTRLIR4EO26KDZVYDZBAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43ASLTON2WKOZSGUYTIOJQHA2TCOA. You are receiving this because you are subscribed to this thread. [https://s-install.avcdn.net/ipm/preview/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free.www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>

I noticed that. I moved my libraries to "Bin\Lib" already.

VBAndCs commented 1 month ago

I haven't change anything related to external libraries for a very long time. I tested the demolib and litDev and they work fine in debug mode. Either you didn't add the dll files in thee bin\lib folder, or your external lib has some issues related to closing the connection after finishing using them. You may find some methods in the lib like Close or Dispose that you should call before closing the program. Note also that the debugger runs in the sVB process, so all Shared/Static fields of the libraries keep their values, and this may cause some issues when you run the debugger more than once. So, you should be careful when using the debugger, and sometimes you may have to restart sVB to reinitialize external libraries. I can't do anything further to solve this.


From: dynamicboy @.> Sent: Monday, September 9, 2024 9:14 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83)

Add your external libraries to the bin folder of sVB. The new version path has changed and now exists in the C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3 folder … ____ From: dynamicboy @.> Sent: Monday, September 9, 2024 8:58 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Subscribed @.***> Subject: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83https://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83) My old project runs smoothly in version 3.0.8.4, but it keep throwing exceptions when I try to use version 3.0.9.x. The first excption I encountered with is "Object reference not set to an instance of an object." when I selected a combobox item which I added to the form by code. In OnSelection event, I remove all items and retrieve from database to fill it again. In Debug Mode, TextWindows shows: LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found LDDataBase.GetDataBase: Database not found Press any key to close the window... LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found LDDataBase.ExtractDll: Access to the path "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.0.9.3\Bin\lib\SQLite.Interop.dll" is denied. LDDataBase.ConnectSQLite: Unable to load DLL "SQLite.Interop.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E). LDDataBase.GetDataBase: Database not found (I use AI to translate chinese characters to english) In normal mode, database operation is OK. — Reply to this email directly, view it on GitHub<#83https://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVTZCIVTRLIR4EO26KDZVYDZBAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43ASLTON2WKOZSGUYTIOJQHA2TCOA. You are receiving this because you are subscribed to this thread. [https://s-install.avcdn.net/ipm/preview/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free.www.avast.comhttps://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail<http://www.avast.com%3Chttps://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>

I noticed that. I moved my libraries to "Bin\Lib" already.

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83#issuecomment-2339101911, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVUBXSDUE2PHHXPESVTZVYFSTAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZZGEYDCOJRGE. You are receiving this because you commented.Message ID: @.***>

dynamicboy commented 1 month ago

The key point is that everything works fine in sVB 3.0.8.4, and database operations also function normally in normal mode in sVB 3.0.9.3. I'm using the Litdev Extension API's "LDDataBase".

In sVB 3.0.9.3, the first exception I encountered was "Object reference not set to an instance of an object", which occurred when I selected a combobox item that I had added to the form via code. In the OnSelection event, I remove all items and retrieve them from the database to refill it.

There were no exceptions in sVB 3.0.8.4.

If I want to use sVB 3.0.9.x, the "Object reference not set to an instance of an object" exception needs to be resolved; otherwise, I'll have to roll back to sVB 3.0.8.4, which has a weird string concatenation problem that's hindering my progress to some extent. The project consists of over three thousand lines of code.

VBAndCs commented 1 month ago

Send me a demo project that shows the combobox error. I fixed one issue related to listbox yesterday, but I don't know if it can fix the combobox issue. I did some changes in the combobox because it doesn't update its text in the OnSelection event, which I tried to workaround.


From: dynamicboy @.> Sent: Tuesday, September 10, 2024 2:31 AM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83)

The key point is that everything works fine in sVB 3.0.8.4, and database operations also function normally in normal mode in sVB 3.0.9.3. I'm using the Litdev Extension API's "LDDataBase".

The first exception I encountered was "Object reference not set to an instance of an object", which occurred when I selected a combobox item that I had added to the form via code. In the OnSelection event, I remove all items and retrieve them from the database to refill it.

There were no exceptions in sVB 3.0.8.4.

If I want to use sVB 3.0.9.x, the "Object reference not set to an instance of an object" exception needs to be resolved; otherwise, I'll have to roll back to sVB 3.0.8.4, which has a weird string concatenation problem that's hindering my progress to some extent. The project consists of over three thousand lines of code.

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83#issuecomment-2339488147, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVVASIJV6F65IIFDP7DZVZKXHAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZZGQ4DQMJUG4. You are receiving this because you commented.Message ID: @.***>

dynamicboy commented 1 month ago

Send me a demo project that shows the combobox error. I fixed one issue related to listbox yesterday, but I don't know if it can fix the combobox issue. I did some changes in the combobox because it doesn't update its text in the OnSelection event, which I tried to workaround. ____ From: dynamicboy @.> Sent: Tuesday, September 10, 2024 2:31 AM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83) The key point is that everything works fine in sVB 3.0.8.4, and database operations also function normally in normal mode in sVB 3.0.9.3. I'm using the Litdev Extension API's "LDDataBase". The first exception I encountered was "Object reference not set to an instance of an object", which occurred when I selected a combobox item that I had added to the form via code. In the OnSelection event, I remove all items and retrieve them from the database to refill it. There were no exceptions in sVB 3.0.8.4. If I want to use sVB 3.0.9.x, the "Object reference not set to an instance of an object" exception needs to be resolved; otherwise, I'll have to roll back to sVB 3.0.8.4, which has a weird string concatenation problem that's hindering my progress to some extent. The project consists of over three thousand lines of code. — Reply to this email directly, view it on GitHub<#83 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVVASIJV6F65IIFDP7DZVZKXHAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZZGQ4DQMJUG4. You are receiving this because you commented.Message ID: @.***>

"Yes, I think it's a listbox issue. I must have confused it with a combobox.

First, drag a listbox onto the form. code:

For I = 1 To 3
   ListBox1.AddItem(I)
Next
' ------------------------------------------------
Sub ListBox1_OnSelection()

EndSub

This will trigger the exception I encountered.

I have a lot of code in my OnSelection event, so I'm removing blocks of lines one by one to identify the issue.

VBAndCs commented 1 month ago

Yes. this is thee bug that I've fixed yesterday. It has nothing to do with your code. I will publish sVB 3.0.9.4 within an hour, but you should try many apps using it, becuase I made many modifications which passed the sVB tests but I need to be 100% sure that I didn't miss with anything.


From: dynamicboy @.> Sent: Tuesday, September 10, 2024 10:51 AM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83)

Send me a demo project that shows the combobox error. I fixed one issue related to listbox yesterday, but I don't know if it can fix the combobox issue. I did some changes in the combobox because it doesn't update its text in the OnSelection event, which I tried to workaround. … ____ From: dynamicboy @.> Sent: Tuesday, September 10, 2024 2:31 AM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83https://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83) The key point is that everything works fine in sVB 3.0.8.4, and database operations also function normally in normal mode in sVB 3.0.9.3. I'm using the Litdev Extension API's "LDDataBase". The first exception I encountered was "Object reference not set to an instance of an object", which occurred when I selected a combobox item that I had added to the form via code. In the OnSelection event, I remove all items and retrieve them from the database to refill it. There were no exceptions in sVB 3.0.8.4. If I want to use sVB 3.0.9.x, the "Object reference not set to an instance of an object" exception needs to be resolved; otherwise, I'll have to roll back to sVB 3.0.8.4, which has a weird string concatenation problem that's hindering my progress to some extent. The project consists of over three thousand lines of code. — Reply to this email directly, view it on GitHub<#83 (comment)https://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83#issuecomment-2339488147>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVVASIJV6F65IIFDP7DZVZKXHAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZZGQ4DQMJUG4. You are receiving this because you commented.Message ID: @.***>

"Yes, I think it's a listbox issue. I must have confused it with a combobox.

First, drag a listbox onto the form. code:

For I = 1 To 3 ListBox1.AddItem(I) Next ' ------------------------------------------------ Sub ListBox1_OnSelection()

EndSub

This will trigger the exception I encountered.

I have a lot of code in my OnSelection event, so I'm removing blocks of lines one by one to identify the issue.

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83#issuecomment-2340327540, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVT7W4VQHFTLKF3RRCTZV3FL5AVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBQGMZDONJUGA. You are receiving this because you commented.

VBAndCs commented 1 month ago

sVB 3.0.9.4 is now available: https://marketplace.visualstudio.com/items?itemName=ModernVBNET.sVBInstaller But it doesn't play sound on my win 10 PC. so please try it.


From: dynamicboy @.> Sent: Tuesday, September 10, 2024 10:51 AM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83)

Send me a demo project that shows the combobox error. I fixed one issue related to listbox yesterday, but I don't know if it can fix the combobox issue. I did some changes in the combobox because it doesn't update its text in the OnSelection event, which I tried to workaround. … ____ From: dynamicboy @.> Sent: Tuesday, September 10, 2024 2:31 AM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83https://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83) The key point is that everything works fine in sVB 3.0.8.4, and database operations also function normally in normal mode in sVB 3.0.9.3. I'm using the Litdev Extension API's "LDDataBase". The first exception I encountered was "Object reference not set to an instance of an object", which occurred when I selected a combobox item that I had added to the form via code. In the OnSelection event, I remove all items and retrieve them from the database to refill it. There were no exceptions in sVB 3.0.8.4. If I want to use sVB 3.0.9.x, the "Object reference not set to an instance of an object" exception needs to be resolved; otherwise, I'll have to roll back to sVB 3.0.8.4, which has a weird string concatenation problem that's hindering my progress to some extent. The project consists of over three thousand lines of code. — Reply to this email directly, view it on GitHub<#83 (comment)https://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83#issuecomment-2339488147>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVVASIJV6F65IIFDP7DZVZKXHAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZZGQ4DQMJUG4. You are receiving this because you commented.Message ID: @.***>

"Yes, I think it's a listbox issue. I must have confused it with a combobox.

First, drag a listbox onto the form. code:

For I = 1 To 3 ListBox1.AddItem(I) Next ' ------------------------------------------------ Sub ListBox1_OnSelection()

EndSub

This will trigger the exception I encountered.

I have a lot of code in my OnSelection event, so I'm removing blocks of lines one by one to identify the issue.

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83#issuecomment-2340327540, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVT7W4VQHFTLKF3RRCTZV3FL5AVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBQGMZDONJUGA. You are receiving this because you commented.Message ID: @.***>

dynamicboy commented 1 month ago

string concatenation is OK! ✅ listbox selection is OK!✅

⚠️New Exception with multi-form app:

Form1 ( drag a button onto the form):

Sub Button1_OnClick()
   argsArr = {}   
   argsArr.Append(Me.Left)
   argsArr.Append(Me.Top + 100)   
   Me.ShowChildForm("Form2", argsArr)
EndSub

Form2:

Sub Form2_OnShown()
  ‘ if nothing here, it's ok, but with code I used as below or others, it will throw a exception.

   argsArr = Me.ArgsArr
   mainFormLeft = argsArr.GetItemAt(1)
   mainFormTop = argsArr.GetItemAt(2)   
   Me.Left = mainFormLeft
   Me.Top = mainFormTop + 200   
EndSub
dynamicboy commented 1 month ago

⚠️New Exception with Label.Tag ( Drag a label onto the form ):

Label1.Tag = {1}

' ------------------------------------------------
Sub Label1_OnClick()
   lblTarget = Event.SenderControl   

   ' This is the line of code which throw the exception
   index = Array.GetItemAt(lblTarget.Tag, 1)   

EndSub
dynamicboy commented 1 month ago

✅ Incidentally, I've found that version 3.0.9.4 plays sound normally on my Windows 10 PC.

dynamicboy commented 1 month ago

⚠️TextBox's Focus() issue:

TextBox1.OnLostFocus = OnCheck

Sub OnCheck()
   textBoxSender = Event.SenderControl

   If textBoxSender.Text = "" Then
      Dialogs.MsgBox("Alert", "Required!")

     ‘ This line triggers a continuous OnLostFocus event.
     ‘ It is supposed to restore focus to the textbox, enabling user input, nothing else.
      textBoxSender.Focus()
   EndIf
EndSub
dynamicboy commented 1 month ago

By the way, can I localize the button text in Dialogs.MsgBox, such as replacing 'Yes' with '是', 'No' with '否', and 'Cancel' with '取消'? Moreover, it seems that MsgBox does not always require all three buttons, as it often simply displays a message that does not require further response.

It's same in Dialogs.InputBox.

dynamicboy commented 1 month ago

By the way, is it possible to invoke a parent form's method from a child form, or even after the child form is closed? For instance, I want to modify settings in the child form to update the properties of controls on the parent form.

Currently, I'm using a timer to monitor a global variable in global.sb file as an intermediate bridge.

VBAndCs commented 1 month ago

The Focus issue is an old one, and I couldn't solve it, due issues in WPF. Never try to get the focus back. Let the user do whatever he wants and just set the error. By the way, the WPF ComboBox has some issues in win 10, so it doesn't change its the Background color nor border color! I need to override its template but I am kinda lazy to do it!


From: dynamicboy @.> Sent: Tuesday, September 10, 2024 8:22 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83)

⚠️TextBox's Focus() issue:

TextBox1.OnLostFocus = OnCheck

Sub OnCheck() textBoxSender = Event.SenderControl

If textBoxSender.Text = "" Then Dialogs.MsgBox("Alert", "Required!")

 ‘ This line triggers a continuous OnLostFocus event.
 ‘ It is supposed to restore focus to the textbox, enabling user input, nothing else.
  textBoxSender.Focus()

EndIf EndSub

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83#issuecomment-2341943498, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVRIUVMOGZF4ETKTLUTZV5IJ7AVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBRHE2DGNBZHA. You are receiving this because you commented.Message ID: @.***>

VBAndCs commented 1 month ago

The Dialogs project is written with sVB and its source code located in the sVB Samples\sVB Libraries folder, so you can change it as you want and copy its exe to the lib folder.


From: dynamicboy @.> Sent: Tuesday, September 10, 2024 8:33 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83)

By the way, can I localize the button text in Dialogs.MsgBox, such as replacing 'Yes' with '是', 'No' with '否', and 'Cancel' with '取消'? Moreover, it seems that MsgBox does not always require all three buttons, as it often simply displays a message that does not require further response.

It's same in Dialogs.InputBox.

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83#issuecomment-2341960253, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVRPKL2XIE7H6T3JYDTZV5JSFAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBRHE3DAMRVGM. You are receiving this because you commented.

VBAndCs commented 1 month ago

The only ways to communicate between forms are: global.sb ArgsArr DialogReesult

You don't need a timer. You can use a method in the Global.sb like this: Sub ApplyChanges(targetForm, valuesArr) targetForm.BackColor = valuesArr[1] ' etc End Sub

And call it from the child form:

Global.ApplyChanges("Form1", {Colors.Red, 100, "Hello"})


From: dynamicboy @.> Sent: Tuesday, September 10, 2024 8:42 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83)

By the way, is it possible to invoke a parent form's method from a child form, or even after the child form is closed? For instance, I want to modify settings in the child form to update the properties of controls on the parent form.

Currently, I'm using a timer to monitor a global variable in global.sb file as an intermediate bridge.

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83#issuecomment-2341973793, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVWECV63LVPRMEUFLCTZV5KSTAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBRHE3TGNZZGM. You are receiving this because you commented.Message ID: @.***>

VBAndCs commented 1 month ago

All reported issues are fixed in sVB 3.0.9.5 https://marketplace.visualstudio.com/items?itemName=ModernVBNET.sVBInstaller Please try your large apps and make sure they work fine with this release. Thanks


From: dynamicboy @.> Sent: Tuesday, September 10, 2024 8:42 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83)

By the way, is it possible to invoke a parent form's method from a child form, or even after the child form is closed? For instance, I want to modify settings in the child form to update the properties of controls on the parent form.

Currently, I'm using a timer to monitor a global variable in global.sb file as an intermediate bridge.

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83#issuecomment-2341973793, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVWECV63LVPRMEUFLCTZV5KSTAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBRHE3TGNZZGM. You are receiving this because you commented.

VBAndCs commented 1 month ago

On second thought, I found that you can access another form directly. Use this code in form2: form1 = "form1" form1.BackColor = Colors.AliceBlue It will work! The idea is that the Forms dictionary is global to the whole application including loaded external libraries, so using the naming convention trick (any var name that starts or ends with the word form like form1) and setting it to the form key (name), you will be able to deal with the form. You can do a similar thing with controls. For example, to access the button on form1: button1 = "form1.button1" button1 .Text = "Test" But note that code will only work when form1 is loaded. If form1 is closed the code will cause an error. The global file solves another issue, as you can't call a subroutine written in a form from another one, so, the global file is the best place to write such subroutines.


From: dynamicboy @.> Sent: Tuesday, September 10, 2024 8:42 PM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83)

By the way, is it possible to invoke a parent form's method from a child form, or even after the child form is closed? For instance, I want to modify settings in the child form to update the properties of controls on the parent form.

Currently, I'm using a timer to monitor a global variable in global.sb file as an intermediate bridge.

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83#issuecomment-2341973793, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVWECV63LVPRMEUFLCTZV5KSTAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBRHE3TGNZZGM. You are receiving this because you commented.

dynamicboy commented 1 month ago

I attempted this approach, but found it becoming overly complex when the parent form's actions interacted with the child form to manipulate multiple controls and array variables. Instead, I decided to utilize a timer in the parent form to monitor the signal variable and employ an args array in the global.sb file, which proved to be a more intuitive solution. The approach I initially attempted, however, is more suitable for setting control properties.

By the way, this version works fine with all my projects, except that it occasionally reports false errors, claiming that I've added '()' to event names when I haven't, or failing to find 'Me', etc., and these false reports often include negative line numbers.

VBAndCs commented 1 month ago

Errors about negative numbers refers to the code in the form.sb.gen file. The Me error may happen when the form is not saved (why??) and can be fixed by showing the form designer and save the form, or make any change to a control and switch back to the code editor. This didn't happen to me for a long time. The error of parans after event name is strange. It should happen when you add parans, but I actually made the editor remove them in the new version, so this should not happen at all. If I encounter it, I will fix it.


From: dynamicboy @.> Sent: Sunday, September 15, 2024 8:14 AM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Mohammad Hamdy Ghanem @.>; Comment @.> Subject: Re: [VBAndCs/sVB-Small-Visual-Basic] Version 3.0.9.3 fails to run my 3.0.8.4 project. (Issue #83)

I attempted this approach, but found it becoming overly complex when the parent form's actions interacted with the child form to manipulate multiple controls and array variables. Instead, I decided to utilize a timer in the parent form to monitor the signal variable and employ an args array in the global.sb file, which proved to be a more intuitive solution. The approach I initially attempted, however, is more suitable for setting control properties.

By the way, this version works fine with all my projects, except that it occasionally reports false errors, claiming that I've added '()' to event names when I haven't, or failing to find 'Me', etc., and these false reports often include negative line numbers.

— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/83#issuecomment-2351457271, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVQOJZX5OTOTIQ2BG73ZWU6XTAVCNFSM6AAAAABN5LBT2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJRGQ2TOMRXGE. You are receiving this because you commented.Message ID: @.***>