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.

Textfeld überprüfen

Empfohlene Antworten

Hallo,

wie bereits bekannt gegeben bin ich ein VB-Leie.

Ich habe ein Textfeld

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged


End Sub
das will ich jetzt überprüfen lassen ob z.B das Passwort "asdf1234" drinnen steht, wenn ja dann soll es ein anderen Frame auf true setzen und diese Frame anzeigen. Das hauptprogramm ist ja
Public Class Form1


    Private Sub Form1_Load()

    End Sub

muss ich dass dann zu Form2 umbennenen und das Passwortfeld dann als Form1 hernehmen?

Ich wäre über eine Hilfe sehr dankbar

Vielen Dank

du willst das passwort hardcoded verdrahten? ich persönlich finde das höchst unschick.

von welchen "Frames" redest du? meinst du die Forms?

ansonsten:

if(TextBox1.Equals("asdf1234")) Then ...

s'Amstel

Attribute VB_Name = "frmpasswort"

Attribute VB_GlobalNameSpace = False

Attribute VB_Creatable = False

Attribute VB_PredeclaredId = True

Attribute VB_Exposed = False



Option Explicit

Dim passwort As String '=passwort in install.dll

Dim passwortvb As String '=eingegebens passwort in vb passwort abfrage

Dim pfad As String '=pfad der install.dll

Dim leer As String '=nicht benötigte zeile in install.dll für diese form


Private Sub Timer1_Timer()


frmpasswort.Visible = True

passwortvb = txtpasswort.Text



' Diese Zeile öffnet die Datei als input , ausgabe

Open ("C:\pw.txt") For Input As #1


'setzt variable passwort als erste Zeile aus der Datei

Input #1, leer

Input #1, leer

Input #1, leer

Input #1, passwort


'schliesst die datei

Close #1


If passwort = passwortvb Then 'vergleicht passwort eingabe mit install.dll

frmauswahl.Visible = True

frmpasswort.Visible = False

Timer1.Interval = 0

Else: Timer1.Interval = 50

End If

würde der code in vb.NET gehen?

frmauswahl.Visible = True

frmpasswort.Visible = False

hier soll es dann eben die Form1 auf true setzen, dass diese angezeigt wird wenn das passwort aus der Textdatei gelesen wurde. Das Passwortfeld soll dannach verschwinden.

vielen dank für die hilfe

if(TextBox1.Equals("asdf1234")) Then ...

sieht auch gut aus funktioniert, weisst du eventuell wie ich das passwort aus einer textdatei lesen lassen kann? würdest mir sehr behilflich sein.

Vielen Dank für eure Tipps..

VB 6:

Open "c:\myfile.txt" For Input As #1

VB.NET:

FileOpen(1, "c:\myfile.txt", OpenMode.Input)

gibt aber natürlich noch andere ansätze, dateien zu verarbeiten.

s'Amstel

vielen dank, wäre der restliche code von mir dann gleich?

Eine blöde Frage hätte ich noch

Attribute VB_Name = "frmpasswort"

Attribute VB_GlobalNameSpace = False

Attribute VB_Creatable = False

Attribute VB_PredeclaredId = True

Attribute VB_Exposed = False



Option Explicit

Dim passwort As String '=passwort in install.dll

Dim passwortvb As String '=eingegebens passwort in vb passwort abfrage

Dim pfad As String '=pfad der install.dll

Dim leer As String '=nicht benötigte zeile in install.dll für diese form
muss sowas ganz oben über
Public Class Form1


    Private Sub Form1_Load()


    End Sub

geschrieben werden oder wo kommen solche dims.. hin. Sorry ich bin blutiger Anfänger

sieht auch gut aus funktioniert, weisst du eventuell wie ich das passwort aus einer textdatei lesen lassen kann? würdest mir sehr behilflich sein.

Vielen Dank für eure Tipps..

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

If (TextBox1.Equals("1234")) Then

Button22.Visible = True

End If

End Sub

habe das mal so gemacht, funktioniert aber leider nicht wenn ich dann in das textfeld 1234 eingebe wird der button nicht auf True gesetzt.

Habe es hinbekommen mit

Option Explicit On

Public Class Form1

    Dim passwort As String '=passwort in install.dll

    Dim passwortvb As String '=eingegebens passwort in vb passwort abfrage

    Dim pfad As String '=pfad der install.dll

    Dim leer As String '=nicht benötigte zeile in install.dll für diese form


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        FileOpen(1, "c:\pw.txt", OpenMode.Input)

        passwortvb = TextBox1.Text

        Input(1, passwort)

        FileClose(1)

        If TextBox1.Text <> passwort Then

            MsgBox("Das Eingabefeld ist leer oder Sie haben kein gueltiges Passwort" & vbCr & "" & vbCr & "Bitte verlassen Sie diese Anwendung", vbInformation, "Anmeldung")

        Else

            Form2.Show()

            Me.Hide()

        End If

    End Sub

End Class

Es funktioniert einwandfrei.

Vielen Dank für eure Hilfe.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Konto

Navigation

Suchen

Suchen

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.