unable to display variable data in text box

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

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 2 years and 7 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.
Locked
User avatar
sivandavid
Posts: 14
Last visit: Wed Jun 21, 2023 3:45 am

Re: unable to display variable data in text box

Post by sivandavid »

localpct wrote: Fri Jul 30, 2021 5:45 pm New issue,
New thread

Also post the error PSS throws from the output tab
I can't check the PSS output as I use PSS on my computer (windows 10) and I compile it to EXE and transfer it to the server to check
User avatar
sivandavid
Posts: 14
Last visit: Wed Jun 21, 2023 3:45 am

Re: unable to display variable data in text box

Post by sivandavid »

sivandavid wrote: Sat Jul 31, 2021 12:43 am sorry, I have the entire script working in CLI mode including interactive menus and all and I am trying to build it again in GUI form, I guess I should have upload an image to make it more clear, the load part is working without an issue and I created a different text box next to it for the update and I try to update it same way but it does not execute
I am unable to upload an image as I am new to this forum

thanks
this is the image Image
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: unable to display variable data in text box

Post by jvierra »

sivandavid wrote: Sat Jul 31, 2021 12:54 am
jvierra wrote: Fri Jul 30, 2021 8:34 pm Here is a complete demo of how to update a user object with WinForms.
thank you for going the extra mile to answer my question but I compiled this to EXE and tried it as well and it also don't save the entered fax number, I searched the entire ADSI object for this user and it didn't update
It's just a simple demo of how to coode a form to update an AD object and it hasn't been tested on your system.

Don't make EXEs until you learn how to use PowerShell and Winform with AD. The demo just shows you a number of techniques but you still have to learn PowerShell and how to use the debugger as well as how toi use AD with WinForms.
User avatar
sivandavid
Posts: 14
Last visit: Wed Jun 21, 2023 3:45 am

Re: unable to display variable data in text box

Post by sivandavid »

hi
it's not my first time with PS, most of the time I write very complex scripts but in CLI, I did a few forms but can't understand the reason this specific command fails
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: unable to display variable data in text box

Post by jvierra »

sivandavid wrote: Sat Jul 31, 2021 1:39 am hi
it's not my first time with PS, most of the time I write very complex scripts but in CLI, I did a few forms but can't understand the reason this specific command fails
Your issue may be caused by using an EXE on a protected network as AD is remote to the application and me not behave as expected. That is why you need to use the debugger and account for all exceptions. All of this you wil learn if you take the time to learn PowerShell completely as you are likely justing copying code and trying to reuse it.

I would test the commands you are using at a prompt without a GUI to be sure the simple code actually works as expected.

If there is no update then it is likley you are not getting the esxception. Any update that succeeds will not be thrown out silently. Learning AD more completely would help you troubleshoot this.

You cannot debug or troubleshoot this from an EXE. Use a script to test the code. That is why we have PowerShell installed by default on all current Windows systems.
User avatar
sivandavid
Posts: 14
Last visit: Wed Jun 21, 2023 3:45 am

Re: unable to display variable data in text box

Post by sivandavid »

as I wrote, without GUI it works so the command is good
I am not testing it remotely but on the server itself
I am not sure why you say that I am copying lines from other script but this is just not the case, I wrote 100% of the script myself, I got it to work 100% in powershell CLI but I am trying to recreate it in GUI for a better and faster use
;)
User avatar
sivandavid
Posts: 14
Last visit: Wed Jun 21, 2023 3:45 am

Re: unable to display variable data in text box

Post by sivandavid »

I got it to work perfectly now in GUI, thanks for all the help :D
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: unable to display variable data in text box

Post by jvierra »

sivandavid wrote: Sat Jul 31, 2021 2:38 am I got it to work perfectly now in GUI, thanks for all the help :D
What was your mistake?

By the way the code you said you ran in the CLI wouldn't run in a CLI which is what made me confused.

I recommend trying to ask a simple question with only the basic bits. Long explanations are not useful as questions. You also seemed to be asking more than one competing question.

I still recommend taking the time to learn Power5shell from the bottom up instead of just trying to guess your way through.

There are many good books on PowerShell. I can give you some links if you are interested.
This topic is 2 years and 7 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.
Locked