🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: free.it.visual-basic
Article #1491

Re: Salvataggio

#1491
From: Vincenzo
Date: Thu, 13 May 2004 12:51
66 lines
3185 bytes
"G. Sanna" <gavsan@tin.it> ha scritto nel messaggio
news:9KJoc.183169$hc5.7936624@news3.tin.it...
>
> "Vile_Corspe" <ciao.sonobus@aliceposta.it> ha scritto nel messaggio
> news:dbyoc.181555$hc5.7852534@news3.tin.it...
> > Scusate la domanda, forse banale, purtroppo non sono riuscito a
risolvere
> il
> > problema da solo.
> > Ho creato un semplice progetto che comprende una listbox e un command
> > button. Il cmd button serve per aggiungere elementi alla listbox.
> > Dopo aver aggiunto gli elementi, devo salvare per non perdere i dati
> > inseriti.
> >
> > private sub command1_click()
> >   list1.additem "ciao"
> >   list1.additem "sera"
> > end sub
> >
> >
> Se la richiesta � di salvare i dati sul disco fisso, una soluzione
> semplice potrebbe essere:
>
> Sub CaricaDati()
> Dim testo As String
> Form1.Combo1.Clear: 'azzera la combo1
> Open "Archivio.dat" For Input As #1: 'apri il file in modalit� testo
> sequenziale in lettura
> 10 If EOF(1) Then GoTo 20: 'se non ci sono altri dati da leggere chiudi il
> fie
> Line Input #1, testo: 'carica il testo
> Form1.Combo1.AddItem testo: 'aggiungi il testo sulla combo1
> GoTo 10
> 20 Close #1: 'chiudi il file
> Form1.Combo1.ListIndex = 0: 'posiziona la combo1 sulla prima registrazione
> End Sub
>
> Sub SalvaDati()
> Dim testo As String
> Open "Archivio.dat" For Output As #1: 'apri il file in modalit� testo
> sequenziale in scrittura
> For t = 0 To Form1.Combo1.ListCount - 1: 'leggi le righe di testo dalla
> combo1
> Form1.Combo1.ListIndex = t: 'imposta la riga della combo1
> testo = Form1.Combo1.Text: 'prendi il testo
> Print #1, testo: 'salva sul hard disk
> Next t
> Close #1: 'chiudi il file
> End Sub
>
> puoi copiare ed incollare il codice direttamente sulla sezione "generale
del
> programma"
>
> dopo di che richiamare sia il salvataggio, che il caricamento dei dati a
tuo
> piacimento
>
> buon lavoro
>
> G. Sanna
>
>

Oppure usa i database access ;-)
Technical Details
Message-ID: <zbKoc.183354$hc5.7942578@news3.tin.it>
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!diablo.netcom.net.uk!netcom.net.uk!newsfeed.wirehub.nl!solnet.ch!solnet.ch!irazu.switch.ch!switch.ch!newsmi-eu.news.garr.it!newsmi-us.news.garr.it!newsbo.news.garr.it!NewsITBone-GARR!newsfeed.cineca.it!newsfeed.nettuno.it!news-out.tin.it!news-in.tin.it!news3.tin.it.POSTED!not-for-mail
References: <dbyoc.181555$hc5.7852534@news3.tin.it> <9KJoc.183169$hc5.7936624@news3.tin.it>

Show Full Headers
Complete Article Headers
X-Google-Language: ITALIAN,ASCII
X-Google-Thread: f94ee,bd20b4d9479338d2
X-Google-Attributes: gidf94ee,public
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!diablo.netcom.net.uk!netcom.net.uk!newsfeed.wirehub.nl!solnet.ch!solnet.ch!irazu.switch.ch!switch.ch!newsmi-eu.news.garr.it!newsmi-us.news.garr.it!newsbo.news.garr.it!NewsITBone-GARR!newsfeed.cineca.it!newsfeed.nettuno.it!news-out.tin.it!news-in.tin.it!news3.tin.it.POSTED!not-for-mail
From: "Vincenzo" <v.simone@tiscalinet.it>
Newsgroups: free.it.visual-basic
References: <dbyoc.181555$hc5.7852534@news3.tin.it> <9KJoc.183169$hc5.7936624@news3.tin.it>
Subject: Re: Salvataggio
Lines: 68
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Message-ID: <zbKoc.183354$hc5.7942578@news3.tin.it>
Date: Thu, 13 May 2004 12:51:43 GMT
NNTP-Posting-Host: 80.181.53.28
X-Complaints-To: newsmaster@tin.it
X-Trace: news3.tin.it 1084452703 80.181.53.28 (Thu, 13 May 2004 14:51:43 MET DST)
NNTP-Posting-Date: Thu, 13 May 2004 14:51:43 MET DST
Organization: TIN