Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

visual basic programm

Empfohlene Antworten

Veröffentlicht

hallo

ich hab mal ein vb programm geschrieben dass quadrathzahlen berechnet und ausgibt.

würd mich mal über freuen wenn ihr euere meinung zum code sagt was ich noch besser oder einfacher machen kann.

Gegen fehleinagbe habe ich doch alles abgesichert oder??

Bild

neuesbildbd.png

Code



Dim strausgabe As String
Dim snganfang As Single
Dim sngschritt As Single
Dim sngende As Single
Dim sngvariable As Single


Try
snganfang = CSng(txtanfang.Text)
Catch ex As InvalidCastException
MsgBox("Falsche Eingabe bei Startwert")
txtanfang.Text = ""
txtanfang.Focus() focus
Exit Sub
Return
End Try


Try
sngende = CSng(txtende.Text)
Catch ex As InvalidCastException
MsgBox("Falsche Eingabe bei Endwert")
txtende.Text = ""
txtende.Focus()
Exit Sub
Return
End Try


Try
sngschritt = CSng(txtschritt.Text)
Catch ex As InvalidCastException
MsgBox("Falsche Eingabe bei SChrittweise")
txtschritt.Text = ""
txtschritt.Focus()
Exit Sub
Return
End Try

If snganfang > sngende And sngschritt > 0 Then
MsgBox(" Schrittweise passt nicht")
txtanfang.Text = ""
txtende.Text = ""
txtschritt.Text = ""
Exit Sub
End If


If snganfang < sngende And sngschritt < 0 Then
MsgBox(" Schrittweise passt nicht")
txtanfang.Text = ""
txtende.Text = ""
txtschritt.Text = ""
txtanfang.Focus() '
Exit Sub
End If


If sngschritt = 0 Then
MsgBox(" Schrittweise Darf nicht 0 sein !!")
txtschritt.Text = ""
txtschritt.Focus()
Exit Sub
End If


For sngvariable = snganfang To sngende Step sngschritt
strausgabe = strausgabe + CStr(sngvariable) + " " + CStr(sngvariable ^ 2) + vbCrLf

Next


txtausgabe.Text = CStr(strausgabe)

[/php]

Bearbeitet von grueni

mmh guck mal was da steht bei .net ....

VB.net --> visual basic ?? was ist das vor mir??

VB.NET ist nicht Visual Basic, nur weil es wie Visual Basic aussieht und so ähnlich heißt ;)

Das sind im Kern sogar völlig verschiedene Sprachen.

Das sind im Kern sogar völlig verschiedene Sprachen.

Nicht ganz.

Bzw. die Syntax ist ähnlich (auch wenn VB.NET voll objektorientiert ist).

Aber die Syntax ist auch das Einzige was ähnlich ist (bestimmt, der Grund warum es immernoch Visual Basic heißt :floet:).

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.