Add and replace data ListBoxes (Visual Studio 2013) - visual-studio

I'm very new to Visual Studio. I want to create a currency converter, using Listboxes. But now i'm stuck with this program.
I have multiple cases in my Listbox. This program works as follow:
The user selects a valuta in Listbox "ListboxMunteenheden"
The program show a InputBox. The user enters a number in the InputBox
The selected item will be added in the Listbox "ListBoxWisselkoersen" and
if it is applicable, the value in "ListBoxWisselkoersen" will be replaced.
I don't get the last point working. The selected item won't appear in ListboxWisselkoersen, and I don't get the old data replaced either.
Can anyone help me with this function?
Private Sub ListBoxMunteenheden_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBoxMunteenheden.SelectedIndexChanged
'De Cases worden aangemaakt om de verschillende Munteenheden aan ListBox Wisselkoersen toe te voegen.
Select Case ListBoxMunteenheden.SelectedIndex
Case 0
'De Amerikaanse Dollar wordt toegevoegd aan ListBoxWisselkoersen
Dim AmerikaanseDollar As Decimal
AmerikaanseDollar = InputBox("Geef de wisselkoers >0 en <500 voor de Euro tov Amerikaanse dollars (1 Euro = .... Amerikaanse Dollar): ")
For i = 0 To ListBoxWisselkoersen.Items.Count - 1
' Er wordt gezocht in de tekst van de valuta en vervangen hem met de nieuwe waarde.
If InStr(ListBoxWisselkoersen.Items(i), "Amerikaanse Dollar") > 0 Then
ListBoxWisselkoersen.Items(i) = "1 Euro = " & AmerikaanseDollar.ToString & " Amerikaanse Dollar"
Else
End If
If AmerikaanseDollar <= 0 Or AmerikaanseDollar >= 500 Then
MsgBox("U dient een andere waarde op te geven, tussen de 1 en 499.", MsgBoxStyle.OkOnly)
'Er wordt gecontroleerd of de waarde tussen de 0 en de 500 ligt. Als de MessageBox hieraan voldoet, zal de functie uitgevoerd worden.
End If
Next

Related

Barcode mapping/scanning issues

This is driving me mad.
I searched here and Google for a solution but found none.
My boss asked me to prepare a simple Excel sheet to reprint labels when data is too old and gone from our WMS. I thought "Very simple! I will just have two cells: one with human font and one below with barcode". I was too quick.
I can key in our product
BZ-BB1/2589 B
But when I scan the barcode I get
BZ'BB1-2589 BB1
The installed barcode font is "Free 3 of 9".
Why the minus and slash signs are converted ? How can I solve this? And it seems that some text is repeated at the end.
Any help is greatly appreciated.
Thanks.
The font "Free 3 of 9" needs also a VBA code
Public Function Code39$(chaine$)
'V 1.0.0
'Paramètres : une chaine
'Retour : * une chaine qui, affichée avec la police CODE39.TTF, donne le code barre
' * une chaine vide si paramètre fourni incorrect
Dim i%
Code39$ = ""
If Len(chaine$) > 0 Then
'Vérifier si caractères valides
For i% = 1 To Len(chaine$)
Select Case Asc(Mid$(chaine$, i%, 1))
Case 32, 36, 37, 43, 45 To 57, 65 To 90
Case Else
i% = 0
Exit For
End Select
Next
If i% > 0 Then
Code39$ = "*" & chaine$ & "*"
End If
End If
End Function
However, the free font C39HrP24DhTt only needs a formula
="*"&A1&"*"
Keyboard layout issue, people with ENG layout keyboard can scan the barcode properly.

Explanation of error using "color" in a batch script

In order to set the color of a batch script's console/terminal, color can be used. E.g. color 70. However, in order to reset the color of a the console, color without any arguments/values can be used. What is causing confusion for me is why it only works inside the command prompt or a called script but not a script started specifically with cmd /c. It fails and returns an errorcode of 1. Is there some legacy reason for this or is it a bug in Windows?
cmd /c color || echo foobar
Output: foobar
Expected output:
cmd /c color 70 || echo foobar
Output:
Expected output:
call color || echo foobar
Output:
Expected output:
To have no error, try to put the default color, as you said,
the color of a the console
That means the default color, I gess, so put color 07, to switch to color black-light grey.
For more info for colors in a .bat file create a .bat file and put in it color h, only this, save it and run it. It will give you all the info about colors.
If you are not able to do this, here is what it will show you. (Sorry, it's in french, but I gess you can understand)
Change les couleurs par défaut du premier et de l'arrière plan de la console.
COLOR [attr]
attr Spécifie les attributs de couleurs de l'apparence de la console
Les attributs de couleurs sont spécifiés par DEUX chiffres hexadécimaux -- le
premier correspond à l'arrière plan, le second au premier plan. Chaque chiffre
peut prendre n'importe quelle de ces valeurs :
0 = Noir 8 = Gris
1 = Bleu foncé 9 = Bleu clair
2 = Vert A = Vert clair
3 = Bleu-gris B = Cyan
4 = Marron C = Rouge
5 = Pourpre D = Rose
6 = Kaki E = Jaune
7 = Gris clair F = Blanc
Si aucun argument n'est donné, cette commande restaure les couleurs
sélectionnées au moment où CMD.EXE a été ouvert. Cette valeur vient soit de la
fenêtre de la console, du commutateur en ligne de commande /T, ou de la valeur
DefaultColor du registre.
Appuyez sur une touche pour continuer...
Again, sorry that is in french
Kalolol

Justify + TabSpaces does not work on CKEDITOR

team!
When I use "config.tabSpaces = 20;" in justified text, he gets different spaces. for example:
first paragraph:
<p style="text-align:justify"> Além disso, constata-se que a parte reclamante recebeu, como última remuneração, valor <strong><u>muito acima do piso dos bancários, diferenciando-o de um SIMPLES CAIXA, quer seja pelas atividades desenvolvida, quer seja pela maior remuneração auferida.</u></strong></p>
second paragraph:
<p style="text-align:justify"> Nesse passo, verifica-se que era depositada uma confiança acima do comum, além daquela que é inerente a qualquer relação de emprego, <strong>e muito diferenciada das responsabilidades daqueles que exercem cargos de base (caixas, agentes ou atendentes comerciais)</strong>, estes sim, bancários comuns.</p>
see that tab spaces were different, microsoft word redistributes spaces as the length of the sentence
someone can help me?
CKEditor is not Microsoft Word. CKEditor is focused on editing fragments of HTML documents from the semantical (structural) POV, not from the visual POV. You cannot expect it to work as Microsoft Word which, despite the seeming similarities, is a totally different tool.
So the behaviour you encountered is the right behaviour, because it is caused by how HTML and CSS works.

How to display latin characters in vbscript MsgBox

I have a vbscript that open message box, but I'm making an spanish version of the program and the latin characters are not displaying well:
MsgBox "No se ha instalado la Consola de Administración pues debe tener instalado Internet Explorer 8 o superior.", vbExclamation, "Atención"
But when I execute the script this is what is displayed:
As you can see, the Latin characters are not well formatted, does someone could advise me how to fix it?
you need to use the chr(#) equivalent
MsgBox "No se ha instalado la Consola de Administraci" + chr(242) + "n pues debe tener instalado Internet Explorer 8 o superior.", vbExclamation, "Atenci" + chr(242) + "n"

Initcap skip words smaller than 4 characters

I've got a question about initcap.
Is it posibible to create an initcap statement to skip the change of words that are smaller than 4 characters.
Because i have to change the words with less than 4 characters back to normal, after i've finished the initcap.
So i tought mabye there is a possibility to create an function/procedure/trigger that will just skip the words?? The words are used in an location name like "Son En Breugel", the "En" in the middle must become lower.
The first letter of the string doesn't need to change, only the first small words after a space(Like in the middle of the string)
I've started to create an procedure, but it needs a bit of finetuning
*All strings that don't need to be changed with initcap are changed back
*Initcap with xDutch format
--Still need to find way to change 'S into 's, i think i've deleted the record with this script?
Can somebody assis me with this??
create or replace PROCEDURE Location_Name_Routine IS
BEGIN
DELETE
FROM Location
WHERE Name LIKE '%[^0-9a-zA-Z]%';
UPDATE Location
set Name = nls_initcap(Name, 'NLS_SORT=xDutch');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' En',' en');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' Van',' van');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' De',' de');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' Den',' den');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' Over','over');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' Aan',' aan');
UPDATE Location
SET Name = REGEXP_REPLACE(Name,' Bij',' bij');
END;
There may not be a simple answer to the underlying question. I assume you are trying to properly capitalize addresses in Dutch and this question is related to this other question from yesterday.
Combining the questions, there are at least three special cases so far:
'S GRAVENHAGE => 's Gravenhage
IJSLAND => IJsland
SON EN BREUGEL => Son en Breugel
INITCAP and even NLS_INITCAP('...', 'NLS_SORT=xDutch') fail to properly handle them. Before you start coding you should collect all the requirements. Are these the only rules for Dutch capitalization, or are there many more?
The answers posted so far may help to solve one specific exception. But chances are you cannot simply combine regular expressions and solve them all. You may want to take a more top-down approach here.
UPDATE
Based on wolφi's idead, it is possible to brute-force the problem by using all existing names. NLS_INITCAP alone works 95% of the time. Using the 431 names from the spreadsheet at this link it is possible to build a list of all 25 exceptional cases.
Run this statement once to build a DECODE expression to handle all non-trivial cases:
--Build decode for UPDATE.
select
--Start the decode
'decode(upper(name),'||
--List all the exceptions. Single quotes are a mess, no way around it.
listagg(
--Upper case version to match
''''||upper(replace(column_value, '''', ''''''))||
--Pre-defined init-capped version
''','''||replace(column_value, '''', '''''')||''''
, ','||chr(10)
)
within group (order by column_value)
||
--Default to NLS_INITCAP
',nls_initcap(name, ''NLS_SORT=xDutch''))'
from table(sys.odcivarchar2list('Bellingwedde','Menterwolde','Oldambt','Pekela','Stadskanaal','Veendam','Vlagtwedde','Appingedam','Delfzijl','Loppersum','Bedum','Ten Boer','Eemsmond','Groningen','Grootegast','Haren','Hoogezand-Sappemeer','Leek','De Marne','Marum','Slochteren','Winsum','Zuidhorn','Achtkarspelen','Ameland','het Bildt','Boarnsterhim','Dantumadiel','Dongeradeel','Ferwerderadiel','Franekeradeel','Harlingen','Kollumerland en Nieuwkruisland','Leeuwarden','Leeuwarderadeel','Littenseradiel','Menaldumadeel','Schiermonnikoog','Terschelling','Tytsjerksteradiel','Vlieland','Bolsward','Gaasterlân-Sleat','Lemsterland','Nijefurd','Sneek','Wûnseradiel','Wymbritseradiel','Heerenveen','Ooststellingwerf','Opsterland','Skarsterlân','Smallingerland','Weststellingwerf','Aa en Hunze','Assen','Midden-Drenthe','Noordenveld','Tynaarlo','Borger-Odoorn','Coevorden','Emmen','Hoogeveen','Meppel','Westerveld','De Wolden','Dalfsen','Hardenberg','Kampen','Ommen','Staphorst','Steenwijkerland','Zwartewaterland','Zwolle','Deventer','Olst-Wijhe','Raalte','Almelo','Borne','Dinkelland','Enschede','Haaksbergen','Hellendoorn','Hengelo','Hof van Twente','Losser','Oldenzaal','Rijssen-Holten','Tubbergen','Twenterand','Wierden','Apeldoorn','Barneveld','Ede','Elburg','Epe','Ermelo','Harderwijk','Hattem','Heerde','Nijkerk','Nunspeet','Oldebroek','Putten','Scherpenzeel','Voorst','Wageningen','Buren','Culemborg','Geldermalsen','Lingewaal','Maasdriel','Neder-Betuwe','Neerijnen','Tiel','West Maas en Waal','Zaltbommel','Aalten','Berkelland','Bronckhorst','Brummen','Doetinchem','Lochem','Montferland','Oost Gelre','Oude IJsselstreek','Winterswijk','Zutphen','Arnhem','Beuningen','Doesburg','Druten','Duiven','Groesbeek','Heumen','Lingewaard','Millingen aan de Rijn','Nijmegen','Overbetuwe','Renkum','Rheden','Rijnwaarden','Rozendaal','Ubbergen','Westervoort','Wijchen','Zevenaar','Almere','Dronten','Lelystad','Noordoostpolder','Urk','Zeewolde','Abcoude','Amersfoort','Baarn','De Bilt','Breukelen','Bunnik','Bunschoten','Eemnes','Houten','IJsselstein','Leusden','Loenen','Lopik','Maarssen','Montfoort','Nieuwegein','Oudewater','Renswoude','Rhenen','De Ronde Venen','Soest','Utrecht','Utrechtse Heuvelrug','Veenendaal','Vianen','Wijk bij Duurstede','Woerden','Woudenberg','Zeist','Andijk','Anna Paulowna','Drechterland','Enkhuizen','Harenkarspel','Den Helder','Hoorn','Koggenland','Medemblik','Niedorp','Opmeer','Schagen','Stede Broec','Texel','Wervershoof','Wieringen','Wieringermeer','Zijpe','Alkmaar','Bergen (NH.)','Heerhugowaard','Heiloo','Langedijk','Schermer','Beverwijk','Castricum','Heemskerk','Uitgeest','Velsen','Bloemendaal','Haarlem','Haarlemmerliede en Spaarnwoude','Heemstede','Zandvoort','Wormerland','Zaanstad','Aalsmeer','Amstelveen','Amsterdam','Beemster','Diemen','Edam-Volendam','Graft-De Rijp','Haarlemmermeer','Landsmeer','Oostzaan','Ouder-Amstel','Purmerend','Uithoorn','Waterland','Zeevang','Blaricum','Bussum','Hilversum','Huizen','Laren','Muiden','Naarden','Weesp','Wijdemeren','Hillegom','Kaag en Braassem','Katwijk','Leiden','Leiderdorp','Lisse','Noordwijk','Noordwijkerhout','Oegstgeest','Teylingen','Voorschoten','Zoeterwoude','''s-Gravenhage','Leidschendam-Voorburg','Pijnacker-Nootdorp','Rijswijk','Wassenaar','Zoetermeer','Delft','Midden-Delfland','Westland','Alphen aan den Rijn','Bergambacht','Bodegraven','Boskoop','Gouda','Nieuwkoop','Reeuwijk','Rijnwoude','Schoonhoven','Vlist','Waddinxveen','Albrandswaard','Barendrecht','Bernisse','Binnenmaas','Brielle','Capelle aan den IJssel','Cromstrijen','Dirksland','Goedereede','Hellevoetsluis','Korendijk','Krimpen aan den IJssel','Lansingerland','Maassluis','Middelharnis','Nederlek','Oostflakkee','Oud-Beijerland','Ouderkerk','Ridderkerk','Rotterdam','Rozenburg','Schiedam','Spijkenisse','Strijen','Vlaardingen','Westvoorne','Zuidplas','Alblasserdam','Dordrecht','Giessenlanden','Gorinchem','Graafstroom','Hardinxveld-Giessendam','Hendrik-Ido-Ambacht','Leerdam','Liesveld','Nieuw-Lekkerland','Papendrecht','Sliedrecht','Zederik','Zwijndrecht','Hulst','Sluis','Terneuzen','Borsele','Goes','Kapelle','Middelburg','Noord-Beveland','Reimerswaal','Schouwen-Duiveland','Tholen','Veere','Vlissingen','Bergen op Zoom','Breda','Drimmelen','Etten-Leur','Geertruidenberg','Halderberge','Moerdijk','Oosterhout','Roosendaal','Rucphen','Steenbergen','Woensdrecht','Zundert','Aalburg','Alphen-Chaam','Baarle-Nassau','Dongen','Gilze en Rijen','Goirle','Hilvarenbeek','Loon op Zand','Oisterwijk','Tilburg','Waalwijk','Werkendam','Woudrichem','Bernheze','Boekel','Boxmeer','Boxtel','Cuijk','Grave','Haaren','''s-Hertogenbosch','Heusden','Landerd','Lith','Maasdonk','Mill en Sint Hubert','Oss','Schijndel','Sint Anthonis','Sint-Michielsgestel','Sint-Oedenrode','Uden','Veghel','Vught','Asten','Bergeijk','Best','Bladel','Cranendonck','Deurne','Eersel','Eindhoven','Geldrop-Mierlo','Gemert-Bakel','Heeze-Leende','Helmond','Laarbeek','Nuenen, Gerwen en Nederwetten','Oirschot','Reusel-De Mierden','Someren','Son en Breugel','Valkenswaard','Veldhoven','Waalre','Beesel','Bergen (L.)','Gennep','Horst aan de Maas','Mook en Middelaar','Peel en Maas','Venlo','Venray','Echt-Susteren','Leudal','Maasgouw','Nederweert','Roerdalen','Roermond','Weert','Beek','Brunssum','Eijsden','Gulpen-Wittem','Heerlen','Kerkrade','Landgraaf','Maastricht','Margraten','Meerssen','Nuth','Onderbanken','Schinnen','Simpelveld','Sittard-Geleen','Stein','Vaals','Valkenburg aan de Geul','Voerendaal'))
where column_value <> nls_initcap(column_value, 'NLS_SORT=xDutch');
Use the result from that statement to build an UPDATE like this:
--Update names to properly init-capped name, as defined by:
--http://epp.eurostat.ec.europa.eu/portal/page/portal/nuts_nomenclature/local_administrative_units
update location
set name =
decode(upper(name),'''S-GRAVENHAGE','''s-Gravenhage',
'''S-HERTOGENBOSCH','''s-Hertogenbosch',
'AA EN HUNZE','Aa en Hunze',
'ALPHEN AAN DEN RIJN','Alphen aan den Rijn',
'BERGEN (NH.)','Bergen (NH.)',
'BERGEN OP ZOOM','Bergen op Zoom',
'CAPELLE AAN DEN IJSSEL','Capelle aan den IJssel',
'GILZE EN RIJEN','Gilze en Rijen',
'HAARLEMMERLIEDE EN SPAARNWOUDE','Haarlemmerliede en Spaarnwoude',
'HOF VAN TWENTE','Hof van Twente',
'HORST AAN DE MAAS','Horst aan de Maas',
'KAAG EN BRAASSEM','Kaag en Braassem',
'KOLLUMERLAND EN NIEUWKRUISLAND','Kollumerland en Nieuwkruisland',
'KRIMPEN AAN DEN IJSSEL','Krimpen aan den IJssel',
'LOON OP ZAND','Loon op Zand',
'MILL EN SINT HUBERT','Mill en Sint Hubert',
'MILLINGEN AAN DE RIJN','Millingen aan de Rijn',
'MOOK EN MIDDELAAR','Mook en Middelaar',
'NUENEN, GERWEN EN NEDERWETTEN','Nuenen, Gerwen en Nederwetten',
'PEEL EN MAAS','Peel en Maas',
'SON EN BREUGEL','Son en Breugel',
'VALKENBURG AAN DE GEUL','Valkenburg aan de Geul',
'WEST MAAS EN WAAL','West Maas en Waal',
'WIJK BIJ DUURSTEDE','Wijk bij Duurstede',
'HET BILDT','het Bildt',
nls_initcap(name, 'NLS_SORT=xDutch'));
If the question is about Dutch place names, would it be an option to have a lookup table? According to eurostat, there are 418 "Gemeenten" on NUTS5/LAU2 level. A list is available at http://epp.eurostat.ec.europa.eu/portal/page/portal/nuts_nomenclature/local_administrative_units. If this is not acceptable, you could at least verify your procedure with the official list...

Resources