issue arose with the errorprovider

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
jsira2003@yahoo.com
Posts: 117
Last visit: Tue Jul 11, 2023 6:18 am

issue arose with the errorprovider

Post by jsira2003@yahoo.com »

I am using the latest version of powershell studio 2017 5.4.145. I am running on a windows 10 64-bit pc.

I used the following code below to filter a directory/share file path. I know this code works well enough for my needs. What
I discovered today with testing is if I type in a long path like the following below the error provider test code hangs the script when I get to the "."

e.g. \\bot\temp\bot-duplicates-report-which-does-not-including-any-filtering-options-whatsoever.txt

I removed the error provider and it works as expected. I use the code to put a message to the screen and it works great.
I would have liked to use the error provider. Unfortunately it hangs. I think this is a bug. I noticed another behavior just prior to failing the code slows down and then hangs. I realize with a long path the errorprovider will get called over 60 times with
the entry of each character.


$textboxFolderReport_TextChanged={
#TODO: Place custom script here
IF (($textbox1Report.text -match '^([a-zA-Z]+:)?(\\[a-zA-Z0-9_.-: :]+)*\\?$') -or ($textbox1Report.text -match '^\\(\\[\w-]+){1,}(\\[\w-()]+(\s[\w-()]+)*)+(\\(([\w-()]+(\s[\w-()]+)*)+\.[\w]+)?)?$') -or ($textbox1Report.Text -match "\\\\([a-zA-Z0-9])+(([\-_])?([a-zA-Z0-9])+)*(?:\\[\w\s$]+)+") -or ($textbox1Report.Text -EQ ""))
{
$errorprovider1Path.clear()
}
else
{
$errorprovider1Path.SetError($textbox1Report, "Invalid File Path")
}

}

Can anything be done here to remedy the situation?

thanks,
John
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: issue arose with the errorprovider

Post by davidc »

Can you attach the psf file to this topic?

Also check that you are running the script in STA mode. Some controls are dependent on this setting to work.
STA Mode.png
STA Mode.png (14.82 KiB) Viewed 2556 times
David
SAPIEN Technologies, Inc.
User avatar
jsira2003@yahoo.com
Posts: 117
Last visit: Tue Jul 11, 2023 6:18 am

Re: issue arose with the errorprovider

Post by jsira2003@yahoo.com »

What is sta mode? Enclosed is the psf file.

thanks,
John
Attachments
DupReport-with-Adj-Threshold.psf
(983.54 KiB) Downloaded 105 times
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: issue arose with the errorprovider

Post by davidc »

After debugging the script, I found that the regular expression is causing the lock up. You might consider using a different method to validate the path.

In regards to STA Mode:

https://www.sapien.com/blog/2015/03/09/ ... -sta-mode/
David
SAPIEN Technologies, Inc.
User avatar
jsira2003@yahoo.com
Posts: 117
Last visit: Tue Jul 11, 2023 6:18 am

Re: issue arose with the errorprovider

Post by jsira2003@yahoo.com »

Since I didn't select sta or mta mode. It should have defaulted with sta mode. I suspect that wasn't my issue. I tried it both with and without the error provider. I only froze while using the error provider.

Thanks,
John
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: issue arose with the errorprovider

Post by davidc »

Set a breakpoint on the line where the error provider is called and run the debugger (F5). If it freezes before that line, then it is the Regular Expression. If it freezes after Stepping (F10) then it is the ErrorProvider.
David
SAPIEN Technologies, Inc.
User avatar
jsira2003@yahoo.com
Posts: 117
Last visit: Tue Jul 11, 2023 6:18 am

Re: issue arose with the errorprovider

Post by jsira2003@yahoo.com »

I elected to ditch the error provider. It is working fine now.

Thanks!
John
This topic is 6 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.