Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Pomoć oko button-a

[es] :: Visual Basic 6 :: Pomoć oko button-a

[ Pregleda: 4280 | Odgovora: 9 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Towar
Ivan Kardum
Split

Član broj: 23258
Poruke: 78
*.cmu.carnet.hr.



Profil

icon Pomoć oko button-a29.10.2004. u 13:27 - pre 236 meseci
Da li se može ikako izvesti ovo:

Ja u programu imam 8 gumbova, trenutno su prazni. Da li netko zna kako izvesti to da netko tko koristi taj program može dati svakom gumbu ime koje on želi i da to save-a.

Hvala
 
Odgovor na temu

mladenovicz
Zeljko Mladenovic
Xoran Technologies, Inc., Ann Arbor, MI,
USA / Software Engineer
Ann Arbor, MI, USA

Član broj: 6598
Poruke: 2065
*.bg.wifi.vline.verat.net.

Jabber: mladenovicz@elitesecurity.org
ICQ: 95144142
Sajt: yubc.net/~mz


Profil

icon Re: Pomoć oko button-a29.10.2004. u 15:48 - pre 236 meseci
Captione cuvaj u INI fajlu, na primer. Na Form_Load loadujes captione i setujes. Koristi pretragu, bilo je dosta reci o radu sa INI fajlovima
 
Odgovor na temu

Towar
Ivan Kardum
Split

Član broj: 23258
Poruke: 78
*.cmu.carnet.hr.



Profil

icon Re: Pomoć oko button-a29.10.2004. u 17:22 - pre 236 meseci
Evo source, kada se upiše neka riječ, tada se ta riječ pojavi kao caption gumbu.
Evo kod koji sam napravio:

Private Sub Exit_Click()
Unload Me
End Sub

Private Sub Save_Click()
frmMain.cmdDataBitToggle(0).Caption = Text1
frmMain.cmdDataBitToggle(1).Caption = Text2
frmMain.cmdDataBitToggle(2).Caption = Text3
frmMain.cmdDataBitToggle(3).Caption = Text4
frmMain.cmdDataBitToggle(4).Caption = Text5
frmMain.cmdDataBitToggle(5).Caption = Text6
frmMain.cmdDataBitToggle(6).Caption = Text7
frmMain.cmdDataBitToggle(7).Caption = Text8
End Sub

To sve radi, ali kad se izađe iz programa i kad se opet pokrene, nema ničega. Kako save-ati???
POMOZITE!!!
Evo slika dialoga-a:


 
Odgovor na temu

mladenovicz
Zeljko Mladenovic
Xoran Technologies, Inc., Ann Arbor, MI,
USA / Software Engineer
Ann Arbor, MI, USA

Član broj: 6598
Poruke: 2065
*.bg.wifi.vline.verat.net.

Jabber: mladenovicz@elitesecurity.org
ICQ: 95144142
Sajt: yubc.net/~mz


Profil

icon Re: Pomoć oko button-a29.10.2004. u 17:25 - pre 236 meseci
Code:

Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, _
ByVal lpFileName As String) As Long

Private Sub Form_Load()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
    Dim Ret As String, NC As Long
    'Write the setting to the file (c:\test.ini) under
    '   Project1 -> Keyname
    WritePrivateProfileString App.Title, "KeyName", "This is the value", "c:\test.ini"
    'Create a buffer
    Ret = String(255, 0)
    'Retrieve the string
    NC = GetPrivateProfileString(App.Title, "KeyName", "Default", Ret, 255, "C:\test.ini")
    'NC is the number of characters copied to the buffer
    If NC <> 0 Then Ret = Left$(Ret, NC)
    'Show our string
    MsgBox Ret
    'Delete the file
    Kill "c:\test.ini"
End Sub

 
Odgovor na temu

Towar
Ivan Kardum
Split

Član broj: 23258
Poruke: 78
*.cmu.carnet.hr.



Profil

icon Re: Pomoć oko button-a29.10.2004. u 17:30 - pre 236 meseci
Mladenoviczu, ne znam kako da zahvalim!!!
 
Odgovor na temu

mladenovicz
Zeljko Mladenovic
Xoran Technologies, Inc., Ann Arbor, MI,
USA / Software Engineer
Ann Arbor, MI, USA

Član broj: 6598
Poruke: 2065
*.bg.wifi.vline.verat.net.

Jabber: mladenovicz@elitesecurity.org
ICQ: 95144142
Sajt: yubc.net/~mz


Profil

icon Re: Pomoć oko button-a29.10.2004. u 19:19 - pre 236 meseci
Code:

Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, _
ByVal lpString As Any, ByVal lpFileName As String) As Long

Private Const mcstrIniFile = "C:\test.ini"

Private Sub cmdSaveSettings_Click()
    WritePrivateProfileString App.Title, "Command1", Command1.Caption, mcstrIniFile
    WritePrivateProfileString App.Title, "Command2", Command2.Caption, mcstrIniFile
    WritePrivateProfileString App.Title, "Command3", Command3.Caption, mcstrIniFile
End Sub

Private Sub Form_Load()
    Command1.Caption = m_ReadSettingsValue("Command1", "Command1", mcstrIniFile)
    Command2.Caption = m_ReadSettingsValue("Command2", "Command2", mcstrIniFile)
    Command3.Caption = m_ReadSettingsValue("Command3", "Command3", mcstrIniFile)
End Sub

Private Function m_ReadSettingsValue(KeyName As String, _
                                     DefaultValue As String, _
                                     FileName As String _
                                     ) As String
    
    Dim Ret As String
    Dim NC  As Long
        
    Ret = String(255, 0)
    NC = GetPrivateProfileString(App.Title, KeyName, DefaultValue, Ret, 255, FileName)
    If NC <> 0 Then Ret = Left$(Ret, NC)
    m_ReadSettingsValue = Ret
End Function

 
Odgovor na temu

Towar
Ivan Kardum
Split

Član broj: 23258
Poruke: 78
*.cmu.carnet.hr.



Profil

icon Re: Pomoć oko button-a29.10.2004. u 22:57 - pre 236 meseci
Opet neće, ne znam šta bi moglo bit. Mladenoviczu, stručnjače, molim te pomozi!
 
Odgovor na temu

gio1000
Italia

Član broj: 1159
Poruke: 122
*.pool8252.interbusiness.it.



Profil

icon Re: Pomoć oko button-a29.10.2004. u 23:42 - pre 236 meseci
U modul deklarisi ove dvije funkcije:
GetPrivateProfileString i WritePrivateProfileString

Takodje u modul mozes staviti i funkcije koje pisu i citaju .ini file.

Ova cita zapisani .ini fajl
Public Function CitajINI(Sekcija As String, Kljuc As String) As String
Dim intLen As Integer
Dim strText As String, strIniFile As String
strIniFile = App.Path + "\dugmici.ini"
strText = Space(80)
intLen = GetPrivateProfileString(Sekcija, Kljuc, "", _
strText, Len(strText), strIniFile)
If intLen > -1 Then
strText = Left(strText, intLen)
Else
MsgBox "Greska u INI fajlu!"
End
End If
ReadINI = strText
End Function

Ovaj sub snima .ini fajl
Public Sub PisiINI(Fajl As String, Sekcija As String, _
Kljuc As String, ByVal Vrijednost As String)
Dim iW As String
iW = WritePrivateProfileString(Sekcija, Kljuc, Vrijednost, Fajl)
End Sub

Ovako pozivas sub koji ce ti snimiti fajl:
Private Sub Command1_Click()
PisiINI App.Path + "\dugmici.ini", "Dugmici", "Button1", "Dugmic Prvi"
PisiINI App.Path + "\dugmici.ini", "Dugmici", "Button2", "Dugmic Drugi"
...
End Sub

E sad ovim procitaj sta si snimio
Private Sub Command2_Click()
Button1.Caption = CitajINI ( "Dugmici", "Button1")
Button2.Caption = CitajINI ( "Dugmici", "Button2")
...
End Sub

Mora da radi

 
Odgovor na temu

Towar
Ivan Kardum
Split

Član broj: 23258
Poruke: 78
*.cmu.carnet.hr.



Profil

icon Re: Pomoć oko button-a29.10.2004. u 23:57 - pre 236 meseci
Puno hvala na trudu, napisao sam jednu još jednostavniju.
Još jednom hvala vam svima!
 
Odgovor na temu

X-Cite
Goran Tadić
Mediacija, Tušmobil
Ljubljana

Član broj: 28706
Poruke: 625
*.dsl.siol.net.

Sajt: www.baza-ukradenih-gsm.co..


Profil

icon Re: Pomoć oko button-a09.11.2004. u 06:31 - pre 236 meseci
Postavi je ovdje ako je još jednostavnija možda prekosutra meni zatreba hehe
Pozdrav
GoGy
 
Odgovor na temu

[es] :: Visual Basic 6 :: Pomoć oko button-a

[ Pregleda: 4280 | Odgovora: 9 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.