Click here to Skip to main content
15,891,184 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Trying to merge exel print jobs Pin
Mycroft Holmes21-Jun-12 22:18
professionalMycroft Holmes21-Jun-12 22:18 
Questionbyte array to string Pin
jkirkerx20-Jun-12 18:06
professionaljkirkerx20-Jun-12 18:06 
SuggestionRe: byte array to string Pin
Sandeep Mewara20-Jun-12 19:36
mveSandeep Mewara20-Jun-12 19:36 
GeneralRe: byte array to string Pin
jkirkerx20-Jun-12 20:10
professionaljkirkerx20-Jun-12 20:10 
GeneralRe: byte array to string Pin
Sandeep Mewara21-Jun-12 19:17
mveSandeep Mewara21-Jun-12 19:17 
GeneralRe: byte array to string Pin
jkirkerx21-Jun-12 20:31
professionaljkirkerx21-Jun-12 20:31 
AnswerRe: byte array to string Pin
Nick Otten21-Jun-12 2:43
Nick Otten21-Jun-12 2:43 
QuestionPassword Storage Class Pin
flinchy318-Jun-12 4:31
flinchy318-Jun-12 4:31 
Is there a way that i can make a class to store passwords from my form1 or form2 to the Windows 7 Registry or a spot on the local Drive?


Public Class Form1

My.Computer.FileSystem.WriteAllText("C:\Pass\PasswordLog.txt", TextBoxLog.Text, True)
End Sub
End Class


or



SOME way to store in the registry... what would the code be for this ?


i tried and failed bad im sure... im a noob with VB but here is what i have for my class that stores passwords in the registry ....

<pre lang="vb">

Imports Microsoft.Win32


' Reads and writes the top three high scores to the registry.
Public Class Passwords
Shared Password As Integer

''' Read Passwords from the registry.
Public Shared Function GetPasswords() As Password()
Dim tops(1) As Password
Dim passKey As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\VBSamples\Collapse\Passwords")
For index As Integer = 0 To 1
Dim key As String = "place" & index.ToString
Dim password As New Password(CStr(passKey.GetValue(key)))
tops(index) = password
Next
passKey.Close()
Return tops
End Function

' Update and write the Passwords.

Public Shared Sub UpdatePasswords(ByVal Password As Integer)
Dim tops(1) As Password
Dim passKey As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\VBSamples\Collapse\Passwords")
tops(0) = New Password(passKey.GetValue("Place0").ToString)
If Password > tops(0).Password Then
Dim name As String = InputBox("New Password " & Password)
tops(1) = New Password("")
tops(1).Password = Password
Array.Sort(tops)
Array.Reverse(tops)
passKey.SetValue("Place0", tops(0).ToString)
End If
passKey.Close()
End Sub

' Set up the entries for new Passwords.
Shared Sub SetUpPasswords()
Dim passKey As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\VBSamples\Collapse\Passwords")
If passKey.GetValue("Place0") Is Nothing Then
passKey.SetValue("Place0", "")
End If
passKey.Close()
End Sub

' Reset Passwords.
Shared Sub ResetPasswords()
Dim passKey As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\VBSamples\Collapse\Passwords")
passKey.SetValue("Place0", "")
passKey.Close()
End Sub
End Class










For the Form1 or Form2 i was thinking something like :

Public Class Passwordz
Private Sub Passwordz_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.DataGrid1.DataSource = HighScores.GetHighScores()
End Sub
Private Sub resetPasswords_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles resetScores.Click
Passwords.ResetPasswords()
Me.DataGrid1.DataSource = Passwords.GetPasswords()
End Sub
End Class

</pre>

my Questions here is would something like this work and how would i go about doing it?


If you would like credit for any code you provide please say so and ill add your name on the project.

-- modified 18-Jun-12 13:41pm.
AnswerRe: Password Storage Class Pin
908236518-Jun-12 6:26
908236518-Jun-12 6:26 
GeneralRe: Password Storage Class Pin
flinchy318-Jun-12 7:28
flinchy318-Jun-12 7:28 
GeneralRe: Password Storage Class Pin
908236519-Jun-12 5:29
908236519-Jun-12 5:29 
GeneralRe: Password Storage Class Pin
flinchy321-Jun-12 4:17
flinchy321-Jun-12 4:17 
GeneralRe: Password Storage Class Pin
908236521-Jun-12 5:30
908236521-Jun-12 5:30 
GeneralRe: Password Storage Class Pin
908236522-Jun-12 10:39
908236522-Jun-12 10:39 
GeneralRe: Password Storage Class Pin
flinchy328-Jun-12 1:20
flinchy328-Jun-12 1:20 
GeneralRe: Password Storage Class Pin
flinchy328-Jun-12 1:25
flinchy328-Jun-12 1:25 
QuestionHow to get session state in VB.NET desktop app Pin
ilgrongo18-Jun-12 3:38
ilgrongo18-Jun-12 3:38 
AnswerRe: How to get session state in VB.NET desktop app Pin
Dave Kreskowiak18-Jun-12 10:53
mveDave Kreskowiak18-Jun-12 10:53 
GeneralRe: How to get session state in VB.NET desktop app Pin
ilgrongo18-Jun-12 13:04
ilgrongo18-Jun-12 13:04 
GeneralRe: How to get session state in VB.NET desktop app Pin
Dave Kreskowiak18-Jun-12 14:51
mveDave Kreskowiak18-Jun-12 14:51 
GeneralRe: How to get session state in VB.NET desktop app Pin
ilgrongo18-Jun-12 19:52
ilgrongo18-Jun-12 19:52 
QuestionWindows 7 Lock app Pin
flinchy316-Jun-12 2:42
flinchy316-Jun-12 2:42 
AnswerRe: Windows 7 Lock app Pin
Dave Kreskowiak16-Jun-12 3:42
mveDave Kreskowiak16-Jun-12 3:42 
GeneralRe: Windows 7 Lock app Pin
flinchy316-Jun-12 16:21
flinchy316-Jun-12 16:21 
GeneralRe: Windows 7 Lock app Pin
Dave Kreskowiak16-Jun-12 17:26
mveDave Kreskowiak16-Jun-12 17:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.