Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
App. WinForms / WPF .NET
Classe connectionString
mercoledì 09 aprile 2014 - 21.48
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
Elenco Tags
VB.NET
|
.NET 4.0
|
Visual Studio 2010
Mau67
Profilo
| Expert
917
messaggi | Data Invio:
mer 9 apr 2014 - 21:48
Un saluto al forum,
volevo chiedervi come posso far dentro un modulo alcune impostazioni salvate in un file tramire dataset?
posto il codice che uso per salvare le impostazioni nel file e caricarle nelle textbox
Private ConfigPathname As String = Application.ExecutablePath + ".Settings"
Private Sub butnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butnSave.Click
Dim xDS As New Settings
Dim xRow As Settings.MainRow
xRow = xDS.Main.NewMainRow
xRow.Username = textUsername.Text.Trim()
xRow.PIN = Int32.Parse(textPIN.Text.Trim())
xRow.Admin = chckAdmin.Checked
xDS.Main.AddMainRow(xRow)
xDS.WriteXml(ConfigPathname, System.Data.XmlWriteMode.IgnoreSchema)
End Sub
Private Sub butnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butnLoad.Click
If New FileInfo(ConfigPathname).Exists Then
Dim xDS As New Settings
Dim xRow As Settings.MainRow
xDS.ReadXml(ConfigPathname, System.Data.XmlReadMode.IgnoreSchema)
If xDS.Main.Rows.Count > 0 Then
xRow = xDS.Main.Rows.Item(0)
If Not xRow.IsUsernameNull() Then
textUsername.Text = xRow.Username
End If
If Not xRow.IsPINNull() Then
textPIN.Text = xRow.PIN.ToString()
End If
If Not xRow.IsAdminNull() Then
chckAdmin.Checked = xRow.Admin
End If
End If
End If
End Sub
io vorrei che invece di caricarle nelle textbox dentro il form vorrei passarle al modulo e renderle disponibili per tutto il progetto
Public Shared Function Getimpostazioni() As String
Return "username=" & username & ";" & _
"pin=" & xRow.PIN.ToString() & ";" & _
"admin=" & xRow.Admin
End Function
come posso fare?
grazie
Mau67
ridaria
Profilo
| Expert
905
messaggi | Data Invio:
gio 10 apr 2014 - 06:07
devi mettere i valori in variabili di tipo public dichiarate possibilmente in un modulo di classe *.vb ove vai a mettere tutte le variabili pubbliche del progetto.
La var publica è questa:
Public ID_CLIENTE As Long = 0
ciao
fammi sapere
Riccardo D'Aria
Mau67
Profilo
| Expert
917
messaggi | Data Invio:
mar 15 apr 2014 - 21:34
Ottimo grazie ciao alla prossima
Mau67
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !