Hide\remove language from VB.Net form list - vb.net

Is there a way to make the language property list shorter? Make it show only EN-US and PT-BR, for instance, so it's easier to find them?

You probably don't need to do it.. You can likely just make your life easier like:
Make a new form, lets say it's called LocalForm.vb
Drop a label on it, lets say called HelloLabel
Set form to de-DE, set the text of the label to Hallo
Set form to fr-FR, set the text of the label to Salut
Set the form back to (default) - you now have LocalForm.resx, LocalForm.de-DE.resx and LocalForm.fr-FR.resx and you can add controls
Add a Button, called StartButton
Double click the LocalForm.de-DE.resx file
Dismiss the "if you mess this up you'll have to fix it yourself" dialog
Add a line for StartButton.Text Starten
Repeat for other language files
Dropping a control named XyzButton on the form, and then visiting each LocalFor.*.resx in turn and adding the locale for it is a lot easier than back-and-forthing with the language setting, though I know why it's done the way MS chose to do it - you're supposed to lay your form out perfectly with all its hundreds of controls, and then switch to French and write all the French for all hundreds controls, and then switch to German and write it all in German.. In a use case like that there isn't a lot of work to do with that awkwardly huge Language dropdown. Incremental adds that way are a bit of a pain..
Perhaps raise a connect bug/feature asking them to put the "already used" languages (as determined by the presence of Form.*.resx files) at the top of the list, and wait many years for it to be implemented :)
Note: There's a bit of a nuisance with this "edit the resx" in that if you rename a control it doesn't always get picked up. Last time I was localizing I threw together an app that watched (FileSystemWatcher) files named *Form.resx and if it saw a change (load the current version, compare to the prev version) that was a rename, it made the same change in the other files (or maybe alerted if they weren't in sync.. can't quite remember now and I've no idea where the code has gone)
Maybe don't rename your controls after you first decide a sensible name for them/add them to the translated resx..

Related

How to undo in Intellij IDEA replace in files?

In intellij 2022.1, I use Ctrl+Shift+R to bring up the Replace in Files window - it shows 100+ matches in 40+ files. The search string and the replace string differ in only one character, for example: this.bar.is.fooed and this.barf.is.fooed. I only need to replace certain instances based on nearby text.
I'm in the groove, clicking the Replace button, checking the next entry, clicking, checking, ... and thinking my brain can keep things straight (it can't; neither can yours:-) I'm halfway through when I realize the last few replaces were wrong.
How can I undo them? Ctrl+Z is grayed out. This related SO question doesn't say and neither does the JetBrains documentation!
Use Local History to revert the changes.
Undo/redo is not supported for Replace dialog, vote for the related request.

Renaming a variable can affect many other files

Just something I'm curious about. Here's what I do:
I have a class with a member(type) who I want to rename to alertType, for example.
I right click the member, Refactor->Rename.. and enter the new name.
I'm prompted if I want to rename getters and setter too, I say yes.
IntelliJ scans my whole project and gives me the list of changes
The default refactoring is so broad, it renames any variable called type, or many html tags.
I know I can exclude/remove these refactorings, but if I forget to do that, it breaks my codebase and I have to revert, which is a bit tedious.
My question is, is there a way to change the default rename behaviour to only include the Field to be renamed and References in code to parameter, method refactorings? I don't think I would ever want the dynamic and comment/string replacements- I'm just trying to quickly rename a single variable.
On the field you want rename, press ShiftF6 and the inline rename refactoring will start. Now press ShiftF6 again, and the rename refactoring dialog will appear. Here you have 2 checkbox settings:
search in comments and strings and search for text occurrences, disable those and it should fix your problem.

How to copy a word document section-by-section

I have to update a word document to the most recent company template but that task is not so easy as it looks.
According to this site all it takes is to perform the described steps but after doing it the document remained as it was before, for instance, the footer and header remained the same, that is, they were not updated to the ones set in the new template.
After spending some time on how to accomplish that task I realized that both the header and footer are not related to the template but to the underlying section instead.
Then, I took another approach that boiled down to copy only the section content without the header and the footer to the already defined sections in the new template and apparently it gets the job done.
Therefore, I would like to know if there is any way to perform these section copying automatically - through VBA - or even other better approach I can take ?
Personally, I wouldn't use VBA unless the task was huge. By the time you've created some code, run it, failed, re-written it, you'll probably find that it could have been completed faster manually, especially if, as appears, this is a one-off job. Of course, if you encounter a task which you realise is repetitive and time-consuming, then you might make use of the Macro Recorder.
I obviously don't have the documents in front of me but:
Do a little planning. Work out how many sections there should be, and of what type (Next Page Section Break, etc.).
Use Draft View and Goto (Ctrl-G), Section to help discover them.
Scribble down an outline of what the final headers/ footers should contain.
If applicable, note down the Style names from both templates and work out which ones need to be replaced.
(I would) work on a copy of the new template and copy the content from the old one. This will copy the styles from the old template at the same time. This might be the wrong way round for you - you'll have to decide this. Try both and see which is easiest to work with.
You can use the Replace dialog (Ctrl-H) to swap one style for another.
Display the Styles Window as well (Ctrl-Alt-Shift-S).
From the Styles Window you can show the Style Manager. From here, and Import/Export, you can Delete, Rename and Copy Styles. Be careful about deleting styles as it is difficult to gauge what they will default to.
I would leave Headers and Footers until (second to) last and, when doing so, start at the beginning of the document and progress forward-only through the Sections, copying from the old template if necessary.
I would leave Bookmarks until the very end; by that time it should be easy to Insert them. If you have copied content from the old document then it should have carried the Bookmarks across as well, so it just a question of making sure that they are still in the right place.
Again, I don't have the templates in front of me, so I appreciate that some of this advice may not be relevant.
Hint: It might take a few attempts to get this right. If you get stuck at some point bear it mind that it might be better to start over - if it gets messy it is sometimes tricky to recover.

Modifying window style by editing binary?

CyLog’s WildRename is a good program for performing batch-renames on files. The problem with it is that while the main window is resizable, it does not have the maximize box which makes it a little frustrating to size and use. Moreover, they have not made any updates in a long time, so the program is essentially discontinued.
I ran WildRename and used WinSpy++ to modify the style of its window to manually include the WS_MINIMIZEBOX style and bam!, it was now functioning as expected.
The question now is how to make this permanent.
My first instinct was to fire up ResHacker, but the problem is that the style that needs to be modified is that of the main window of a non-dialog application, so ResHacker has no way of doing this.
The next thing I tried was to open it in a hex-editor, to find the address(es) of the string corresponding to the titlebar. I then opened the file in W32Dasm and located the address of the code that references the address of the titlebar string. I did all this in an attempt to find the location of where the main dialog is created so that I can modify the style passed to CreateWindow(). Unfortunately, I cannot find a call to CreateWindow anywhere near the reference to the titelbar string and none of the calls to CreateWindowEx that I can find seem to be (obviously) the ones used to create the main window.
Is there an easy/automated way of modifying the style of the main window (assuming a non-dialog application)?
You could use a debugger like OllyDBG to dump the exe memory after the edit with WinSpy++, then use that exe or compare the files to see where the change is if you want to see what you've missed
There has to be a call to CreateWindow/Ex(), especially if it not a dialog from a resource. You just need to look harder. I would use IDA instead of WinDasm. It will decompile the assembly into more understandable code, and it has a built-in debugger. You can put a breakpoint on the title string and see in real-time which code actually touches it, and then follow it back to the accessing code.

Saving a position while coding?

Back in olden times, I used to code with an editor that allowed you to mark where you were in the code with a keypress. You could jump to another point in the same or another file to check a reference or somesuch. When you were ready, you could hit another keypress and return to the point you saved.
I've long since migrated to Dreamweaver and wanted this functionality. Does it exist in DW? If so, I missed that part of the manual. If not, any suggestions on an editor that DOES have that functionality?
Scott.
There is no official way to do it, but you could use the code collapse feature to create something like a bookmark. Collapse the single line and DW will have a mark at that line number until you clear it.