basic

How to avoid GOTO in C++

自作多情 提交于 2020-06-13 08:55:25
问题 I have read that GOTO is bad, but how do I avoid it? I don't know how to program without GOTO . In BASIC I used GOTO for everything. What should I use instead in C and C++? I used GOTO in BASIC like this: MainLoop: INPUT string$ IF string$ = "game" THEN GOTO game ENDIF 回答1: Usually loops like for , while and do while and functions have more or less disposed the need of using GOTO. Learn about using those and after a few examples you won't think about goto anymore. :) 回答2: Consider the

Highlight word to find in VB.NET

拥有回忆 提交于 2020-02-01 09:59:48
问题 I have a RichTextBox (the text where I need to find all the word corresponds to the TextBox), TextBox (for typing the word to find) and a Button, and when I click on the Button, I would like that in the RichTextBox, all the words corresponding to the word written in the TextBox are highlighted with a color (yellow for example). I know how to find the first occurrence of the word but I do not know how to find all the occurrences. The code for highlighting only the first occurrence of the word:

Highlight word to find in VB.NET

◇◆丶佛笑我妖孽 提交于 2020-02-01 09:59:07
问题 I have a RichTextBox (the text where I need to find all the word corresponds to the TextBox), TextBox (for typing the word to find) and a Button, and when I click on the Button, I would like that in the RichTextBox, all the words corresponding to the word written in the TextBox are highlighted with a color (yellow for example). I know how to find the first occurrence of the word but I do not know how to find all the occurrences. The code for highlighting only the first occurrence of the word:

username and password verification vb.net

空扰寡人 提交于 2020-01-11 07:18:33
问题 My program below checks if the userName and the password is in the database( written in visual basic and uses Access database). The program works however, when I type in the userName or password in a different case it still works. For example, if my database has the userName as "john" and the password as "johnspassword", my program accepts the username as "JOHN" and password as "JOHNSPASSWORD". how do i resolve this problem? Dim con As New OleDbConnection("Provider=Microsoft.jet.oledb.4.0

Help: ZX81 BASIC “Peek” function

天大地大妈咪最大 提交于 2020-01-10 05:02:26
问题 I need a way to find if the character ('<') has hit a wall (Black pixel Graphic) -On a ZX81 game. I'm been looking at another game... which uses code if peek(peek 16398 +256*peek 16399) = code "**blackpixel graphic**" then ... Which seems to work for them... Is this correct code? I'm not really knowledgable with addresses and getting memory and stuff. Please help me... -If you know a better way. Please answer :) Thanks, 回答1: Located at addresses 16398 and 16399 are two bytes that form the

Visual Basic: Checking if file exists, if not, create the file

心不动则不痛 提交于 2020-01-06 14:17:38
问题 This is the code. It checks if the file in path exists, if not, it creates the file. I'm getting this error message all the time and I don't know why. Maybe I should close the System.IO.Directory.Exists? If yes, how do I do that? Just so you know, I'm creating a text file. The code If Not (System.IO.Directory.Exists(path)) Then Dim fs3 As FileStream = File.Create(path) End If This is the error message I get: Process can't use the file (path) because some other process is using this file at

Unhandled Exception when trying to add registry key

混江龙づ霸主 提交于 2019-12-31 05:21:09
问题 When I use the following code My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True).SetValue(Application.ProductName, Application.ExecutablePath) to add a registry key to make my program startup automatically, it works on my system but on everyone who I have sent it to gets an "Unhandled Exception" message saying that access is denied. I was wondering if there is a solution to this. Thanks 回答1: You get "Access denied" because you are required to

Reading information from a ListView from another thread in Visual Basic

落花浮王杯 提交于 2019-12-25 08:48:41
问题 I am having a problem reading an item from a ListView. The ListView is in the main thread, and the part where I read it out is in another class and another thread. My code is as follows: Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim ltm As ListViewItem = New ListViewItem ltm.Text = "test1" ltm.SubItems.Add("test2") ltm.SubItems.Add("test3") Me.ListView2.Items.Add(ltm) Dim l As New test Dim x As New Threading.Thread(AddressOf l.readout) End

Auto Find and display objects when input keywords in VB

自古美人都是妖i 提交于 2019-12-24 08:34:34
问题 I'm a newbie in VB form programming. I got a task today, it seems so hard for me. basically, I have 2 forms named: Form1 and Form2. Form1 use for management info of students such as: student's code, name, phone number, etc..i have a button in Form1, when I press it, Form2 will be invoked. i have completed it. the problem is: in Form2, I just have 1 textbox and 1 listbox. how should it work? => when I type in textbox with 1 keyword relate to info of students in Form1, Listbox will display

Reverse engineering a QuickBASIC 3.0 program

无人久伴 提交于 2019-12-24 07:41:20
问题 I have a program (I own the rights) written in QuickBASIC 3.0, though I do not have anymore the source code. Anyone know a decompiler that I can use to see what the program does? Basically it gets some numbers in input and it performs some calculation, showing some results. Nothing too complicated. Thanks 回答1: I haven't seen any publicly available tools but there's a page from a guy who claims to have made one. You could try contacting him. I wouldn't recommend trying it on your own if you