Fala Speaks and Wee Program Part 3 wee code

Day 2,751, 14:19 Published in Ireland Ireland by Releasethe Krakken
They(who) seek to establish government based on the regimentation of all human beings by a handful of individual rulers...call this a new order. Its not new and its not an order. Franklin D Roosevelt

Safeguards are to be put in place to ensure only well known eIrish citizens will have the opportunity to become Premier .. Anthony Colby



Safeguards?

Well anyway guess we know what shape democracy is heading in eIreland.







So well we know what the outcome of a nationwide referendum will be... a block of players voting in safe choices?


Given DC's temper and frequent outbursts. Will we be allowed to criticize the dictator will the Country President be.

What will happen if the dictator distrust the CP will he execute his directives.


Why cant parties vet their CP candidates? How difficult is it to say to a young player of 8 months in the game your not going to back him as candidate.







Instead of safeguard why dont we just say NO to young candidates.

So instead of throwing democracy out of the window we can just pick the right CP candidates.

Else why hold an election. Seems to be sneaky to hold a referendum with safeguards. Thats not a democracy thats a banana republik.


WEE CODE
On to the code why cant they add indexing to this articles plegh

Just a small note did you notice something missing in my code. Well here is a hint it has absolutely no databases. As the games is so short and there is not really any need for storing stuff I did not do this. Most of my other programs is database driven. But I notice with these smallish games that databases slow down execution quite a lot so avoid them as far as I can. It can really bring down your speed from 40 seconds to 14 seconds in a massive algorithm.

But there is no quick guide to this. Programming is one part, human computer interaction and design is quite another topic.

Anyway here is my program running:




Notice I also added labels below and on top the rows and secretcode. this draws the users gaze upwards and show him that this is one column.

They dont need naming.

As you can see I added more detail to my program. One is incremental unlocking of the numbers. By clicking on the secretcode I can lock in values. That values is carried over to the next form.

I was anyway doing this a lot coding in already completed blocks. So cut the unnecessary clicks. Furthermore I added a counter that starts with a new game and stops with the solving.

The X deletes blocks.

Onto some code . Selecting a block is done by an old standard. A multiple choice is taken to one selection. The block besides the legend saves your backcolor and text of the selection.

When I click on a textbox this is the code for its click event

it alsa has a textchange event for when I manually change values

anyway here is the code:

Private Sub txtUSB8_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtUSB8.Click
USClicked(txtUSB😎
End Sub


So I pass all those clicks to a central sub to do the processing.

Most coding was done by find and replace sequences

for example find USA and replace with USB

Vb.net allows you to do this in a module . But I used word.

basically completing the first row and then substituting in different rows.

So here follows USClicke😛

Sub USClicked(ByVal MyTBox As TextBox)
If chkMouse.Checked = True Then
MyTBox.Text = Me.lblSelectedColor.Text
End If
Select Case MyTBox.Text
Case "0"
MyTBox.BackColor = Color.Red
MyTBox.ForeColor = Color.WhiteSmoke
Case "1"
MyTBox.BackColor = Color.Yellow
MyTBox.ForeColor = Color.Black
Case "2"
MyTBox.BackColor = Color.Blue
MyTBox.ForeColor = Color.WhiteSmoke
Case "3"
MyTBox.BackColor = Color.Green
MyTBox.ForeColor = Color.MistyRose
Case "4"
MyTBox.BackColor = Color.Black
MyTBox.ForeColor = Color.WhiteSmoke
Case "5"
MyTBox.BackColor = Color.SaddleBrown
MyTBox.ForeColor = Color.WhiteSmoke
Case "6"
MyTBox.BackColor = Color.Gray
MyTBox.ForeColor = Color.WhiteSmoke
Case "7"
MyTBox.BackColor = Color.MistyRose
MyTBox.ForeColor = Color.Black
Case "8"
MyTBox.BackColor = Color.Purple
MyTBox.ForeColor = Color.White
Case "9"
MyTBox.BackColor = SystemColors.InactiveCaption
MyTBox.ForeColor = Color.Black
Case "x"
MyTBox.Text = ""
ResetToDefault(MyTBox)
Case Else
' MyTBox.Text = ""
Exit Select
End Select
End Sub


So I pass the text to the clicked block and use the selected block text to determine the color and put an appropriate forecolor.

Darker backcolors gets a whitesmoke or mistyrose forecolor whilst lighter backcolors gets a dark forecolor

Ok this goes for websites as well forget about fanciful fonts that is hard to read go with easy readable fonts and consider the basics about backgrounds to forecolor which I discussed above.

The code for textchanging is similar and found in Sub UserBlocksTextChanged(ByVal MyTBox As TextBox)


This is similar but have this decision throw in
If chkMouse.Checked = False Then
So if control is mouse as selected the usclicked sub will run.
To be honest I could have thrown them all in one sub.

Ok I am going to stop here and will next time go though the 4 subs found in the submit button.

Ok eva if you think what has this to do with web programming. Well vb.net also allow you to build web applications. I used to use webservices to connect my databases but switched to full desktop programming later on as it sometimes a pain to get them running

There is quite a lot of tutorials on ASP and IIS or Internet Information Services. A book is also a wise investment most of the time. Windows now is subscription based so you can get on the bus with the new Vb.net or visual studio programming environment for a trial period. Or buy an older version which is cd/book based go for the professional version. they cut their programming environment based on the version of your copy.