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

Odbrojavanje dana?

[es] :: Visual Basic 6 :: Odbrojavanje dana?

[ Pregleda: 4002 | Odgovora: 10 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

KiselinaXP
Crna rupa

Član broj: 54030
Poruke: 232
91.191.17.*

Jabber: kiselina@elitesecurity.org
ICQ: 226466859


Profil

icon Odbrojavanje dana?12.10.2007. u 09:47 - pre 201 meseci
Pozdrav svima.
Imam problem sa odbrojavanjem dana, u txtDatum mi je upisan datum po formatu dd/mm/yyyy, a u txtRok mi je upisano npr. 40 dana. Kako u txtOstalo da mi napise za koliko dana treba da se odradi nesto?
Hvala unapred!
A gde je moj moped ko da je u moravu propo!
Pero kojot genije!
 
Odgovor na temu

Rollback
Goran Božinović
Bor

Član broj: 100881
Poruke: 65



+3 Profil

icon Re: Odbrojavanje dana?12.10.2007. u 13:56 - pre 201 meseci
Na zalost ne mogu da nadjem link za Upload celog projekta ali mislim da ce ti ovo pomoci i ovako:

Code:
Private DateToday As Date


Private Sub Form_Load()
On errror GoTo errorhandler
'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali this is only an example.
If GetStringValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "XTimes") = "Error" Then
CreateKey "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali"
SetStringValue "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "XTimes", "1"
End If
If GetStringValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "XTimes") = "" Then
SetStringValue "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "XTimes", "1"
End If
lblTimes.Caption = GetStringValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "XTimes") & "  times"
If GetStringValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "LDate") = "Error" Then
CreateKey "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali"
SetStringValue "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "LDate", Now + 30
SetStringValue "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "LDate1", Now
End If
If GetStringValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "LDate") = "" Then
SetStringValue "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "LDate", Now + 30
SetStringValue "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "LDate1", Now
End If
lblTrial.Caption = GetStringValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "LDate1")
lblTimes.Caption = GetStringValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "XTimes")
CreateKey "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali"
SetStringValue "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "XTimes", lblTimes.Caption + 1
SetStringValue "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "Date1", Now
lblStart.Caption = GetStringValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "Date1")
SetStringValue "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "Date1", lblStart.Caption
lblExpired.Caption = GetStringValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "LDate")
lblLeft = Format$(days360(lblStart.Caption, lblExpired.Caption), "###,###") & " day(s)"
If Val(lblLeft.Caption) < 0 Then
MsgBox "Your trial version is expired!", vbOKOnly + vbCritical, "Trial Expired"
End
End If
If Val(lblLeft.Caption) > 29 Then
MsgBox "Do not adjust Date/Time. Your trial version is expired!", vbOKOnly + vbCritical, "Trial Expired"
End
Else
ProgressBar1.Value = Val(lblLeft)
End If
Exit Sub
errorhandler:
End Sub

Private Sub Form_Unload(Cancel As Integer)
SetStringValue "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Ali", "Date1", lblStart.Caption
End Sub

Private Sub Timer1_Timer()
DateToday = Now
lblToday.Caption = Format$(DateToday)
End Sub

Public Function days360(dt1 As Date, dt2 As Date) As Long
    
    Dim z1 As Long, z2 As Long
    Dim d1 As Long, d2 As Long
    Dim m1 As Long, m2 As Long
    Dim y1 As Long, y2 As Long
    
    d1 = Day(dt1)
    m1 = Month(dt1)
    y1 = Year(dt1)
    
    d2 = Day(dt2)
    m2 = Month(dt2)
    y2 = Year(dt2)
    
    If d1 = 31 Then
        z1 = 30
    Else
        z1 = d1
    End If
    
    If d2 = 31 And d1 >= 30 Then
        z2 = 30
    Else
        z2 = d2
    End If

    days360 = (y2 - y1) * 360 + (m2 - m1) * 30 + (z2 - z1)

End Function

Kod i nije bas pregledan ali verovatno je to autorov stil pisanja. U projektu je pridruzena Microsoft Windows Common Controls 5.0

A ovo ide u standardnom (.bas) modulu:

Code:
Type FILETIME
    lLowDateTime    As Long
    lHighDateTime   As Long
End Type
 
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long
Declare Function RegQueryValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByRef lpData As Long, lpcbData As Long) As Long
Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Declare Function RegSetValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Long, ByVal cbData As Long) As Long
Declare Function RegSetValueExB Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Byte, ByVal cbData As Long) As Long

Const ERROR_SUCCESS = 0&
Const ERROR_BADDB = 1009&
Const ERROR_BADKEY = 1010&
Const ERROR_CANTOPEN = 1011&
Const ERROR_CANTREAD = 1012&
Const ERROR_CANTWRITE = 1013&
Const ERROR_OUTOFMEMORY = 14&
Const ERROR_INVALID_PARAMETER = 87&
Const ERROR_ACCESS_DENIED = 5&
Const ERROR_NO_MORE_ITEMS = 259&
Const ERROR_MORE_DATA = 234&

Const REG_NONE = 0&
Const REG_SZ = 1&
Const REG_EXPAND_SZ = 2&
Const REG_BINARY = 3&
Const REG_DWORD = 4&
Const REG_DWORD_LITTLE_ENDIAN = 4&
Const REG_DWORD_BIG_ENDIAN = 5&
Const REG_LINK = 6&
Const REG_MULTI_SZ = 7&
Const REG_RESOURCE_LIST = 8&
Const REG_FULL_RESOURCE_DESCRIPTOR = 9&
Const REG_RESOURCE_REQUIREMENTS_LIST = 10&

Const KEY_QUERY_VALUE = &H1&
Const KEY_SET_VALUE = &H2&
Const KEY_CREATE_SUB_KEY = &H4&
Const KEY_ENUMERATE_SUB_KEYS = &H8&
Const KEY_NOTIFY = &H10&
Const KEY_CREATE_LINK = &H20&
Const READ_CONTROL = &H20000
Const WRITE_DAC = &H40000
Const WRITE_OWNER = &H80000
Const SYNCHRONIZE = &H100000
Const STANDARD_RIGHTS_REQUIRED = &HF0000
Const STANDARD_RIGHTS_READ = READ_CONTROL
Const STANDARD_RIGHTS_WRITE = READ_CONTROL
Const STANDARD_RIGHTS_EXECUTE = READ_CONTROL
Const KEY_READ = STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY
Const KEY_WRITE = STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY
Const KEY_EXECUTE = KEY_READ

Dim hKey As Long, MainKeyHandle As Long
Dim rtn As Long, lBuffer As Long, sBuffer As String
Dim lBufferSize As Long
Dim lDataSize As Long
Dim ByteArray() As Byte

'This constant determins wether or not to display error messages to the
'user. I have set the default value to False as an error message can and
'does become irritating after a while. Turn this value to true if you want
'to debug your programming code when reading and writing to your system
'registry, as any errors will be displayed in a message box.

Const DisplayErrorMsg = False


Function SetDWORDValue(SubKey As String, Entry As String, Value As Long)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
   rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) 'open the key
   If rtn = ERROR_SUCCESS Then 'if the key was open successfully then
      rtn = RegSetValueExA(hKey, Entry, 0, REG_DWORD, Value, 4) 'write the value
      If Not rtn = ERROR_SUCCESS Then   'if there was an error writting the value
         If DisplayErrorMsg = True Then 'if the user want errors displayed
            MsgBox ErrorMsg(rtn)        'display the error
         End If
      End If
      rtn = RegCloseKey(hKey) 'close the key
   Else 'if there was an error opening the key
      If DisplayErrorMsg = True Then 'if the user want errors displayed
         MsgBox ErrorMsg(rtn) 'display the error
      End If
   End If
End If

End Function
Function GetDWORDValue(SubKey As String, Entry As String)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
   rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_READ, hKey) 'open the key
   If rtn = ERROR_SUCCESS Then 'if the key could be opened then
      rtn = RegQueryValueExA(hKey, Entry, 0, REG_DWORD, lBuffer, 4) 'get the value from the registry
      If rtn = ERROR_SUCCESS Then 'if the value could be retreived then
         rtn = RegCloseKey(hKey)  'close the key
         GetDWORDValue = lBuffer  'return the value
      Else                        'otherwise, if the value couldnt be retreived
         GetDWORDValue = "Error"  'return Error to the user
         If DisplayErrorMsg = True Then 'if the user wants errors displayed
            MsgBox ErrorMsg(rtn)        'tell the user what was wrong
         End If
      End If
   Else 'otherwise, if the key couldnt be opened
      GetDWORDValue = "Error"        'return Error to the user
      If DisplayErrorMsg = True Then 'if the user wants errors displayed
         MsgBox ErrorMsg(rtn)        'tell the user what was wrong
      End If
   End If
End If

End Function
Function SetBinaryValue(SubKey As String, Entry As String, Value As String)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
   rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) 'open the key
   If rtn = ERROR_SUCCESS Then 'if the key was open successfully then
      lDataSize = Len(Value)
      ReDim ByteArray(lDataSize)
      For i = 1 To lDataSize
      ByteArray(i) = Asc(Mid$(Value, i, 1))
      Next
      rtn = RegSetValueExB(hKey, Entry, 0, REG_BINARY, ByteArray(1), lDataSize) 'write the value
      If Not rtn = ERROR_SUCCESS Then   'if the was an error writting the value
         If DisplayErrorMsg = True Then 'if the user want errors displayed
            MsgBox ErrorMsg(rtn)        'display the error
         End If
      End If
      rtn = RegCloseKey(hKey) 'close the key
   Else 'if there was an error opening the key
      If DisplayErrorMsg = True Then 'if the user wants errors displayed
         MsgBox ErrorMsg(rtn) 'display the error
      End If
   End If
End If

End Function


Function GetBinaryValue(SubKey As String, Entry As String)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
   rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_READ, hKey) 'open the key
   If rtn = ERROR_SUCCESS Then 'if the key could be opened
      lBufferSize = 1
      rtn = RegQueryValueEx(hKey, Entry, 0, REG_BINARY, 0, lBufferSize) 'get the value from the registry
      sBuffer = Space(lBufferSize)
      rtn = RegQueryValueEx(hKey, Entry, 0, REG_BINARY, sBuffer, lBufferSize) 'get the value from the registry
      If rtn = ERROR_SUCCESS Then 'if the value could be retreived then
         rtn = RegCloseKey(hKey)  'close the key
         GetBinaryValue = sBuffer 'return the value to the user
      Else                        'otherwise, if the value couldnt be retreived
         GetBinaryValue = "Error" 'return Error to the user
         If DisplayErrorMsg = True Then 'if the user wants to errors displayed
            MsgBox ErrorMsg(rtn)  'display the error to the user
         End If
      End If
   Else 'otherwise, if the key couldnt be opened
      GetBinaryValue = "Error" 'return Error to the user
      If DisplayErrorMsg = True Then 'if the user wants to errors displayed
         MsgBox ErrorMsg(rtn)  'display the error to the user
      End If
   End If
End If

End Function
Function DeleteKey(Keyname As String)

Call ParseKey(Keyname, MainKeyHandle)

If MainKeyHandle Then
   rtn = RegOpenKeyEx(MainKeyHandle, Keyname, 0, KEY_WRITE, hKey) 'open the key
   If rtn = ERROR_SUCCESS Then 'if the key could be opened then
      rtn = RegDeleteKey(hKey, Keyname) 'delete the key
      rtn = RegCloseKey(hKey)  'close the key
   End If
End If

End Function

Function GetMainKeyHandle(MainKeyName As String) As Long

Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_PERFORMANCE_DATA = &H80000004
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_DYN_DATA = &H80000006
   
Select Case MainKeyName
       Case "HKEY_CLASSES_ROOT"
            GetMainKeyHandle = HKEY_CLASSES_ROOT
       Case "HKEY_CURRENT_USER"
            GetMainKeyHandle = HKEY_CURRENT_USER
       Case "HKEY_LOCAL_MACHINE"
            GetMainKeyHandle = HKEY_LOCAL_MACHINE
       Case "HKEY_USERS"
            GetMainKeyHandle = HKEY_USERS
       Case "HKEY_PERFORMANCE_DATA"
            GetMainKeyHandle = HKEY_PERFORMANCE_DATA
       Case "HKEY_CURRENT_CONFIG"
            GetMainKeyHandle = HKEY_CURRENT_CONFIG
       Case "HKEY_DYN_DATA"
            GetMainKeyHandle = HKEY_DYN_DATA
End Select

End Function

Function ErrorMsg(lErrorCode As Long) As String
    
'If an error does accurr, and the user wants error messages displayed, then
'display one of the following error messages

Select Case lErrorCode
       Case 1009, 1015
            GetErrorMsg = "The Registry Database is corrupt!"
       Case 2, 1010
            GetErrorMsg = "Bad Key Name"
       Case 1011
            GetErrorMsg = "Can't Open Key"
       Case 4, 1012
            GetErrorMsg = "Can't Read Key"
       Case 5
            GetErrorMsg = "Access to this key is denied"
       Case 1013
            GetErrorMsg = "Can't Write Key"
       Case 8, 14
            GetErrorMsg = "Out of memory"
       Case 87
            GetErrorMsg = "Invalid Parameter"
       Case 234
            GetErrorMsg = "There is more data than the buffer has been allocated to hold."
       Case Else
            GetErrorMsg = "Undefined Error Code:  " & Str$(lErrorCode)
End Select

End Function



Function GetStringValue(SubKey As String, Entry As String)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
   rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_READ, hKey) 'open the key
   If rtn = ERROR_SUCCESS Then 'if the key could be opened then
      sBuffer = Space(255)     'make a buffer
      lBufferSize = Len(sBuffer)
      rtn = RegQueryValueEx(hKey, Entry, 0, REG_SZ, sBuffer, lBufferSize) 'get the value from the registry
      If rtn = ERROR_SUCCESS Then 'if the value could be retreived then
         rtn = RegCloseKey(hKey)  'close the key
         sBuffer = Trim(sBuffer)
         GetStringValue = Left(sBuffer, Len(sBuffer) - 1) 'return the value to the user
      Else                        'otherwise, if the value couldnt be retreived
         GetStringValue = "Error" 'return Error to the user
         If DisplayErrorMsg = True Then 'if the user wants errors displayed then
            MsgBox ErrorMsg(rtn)  'tell the user what was wrong
         
         End If
      End If
   Else 'otherwise, if the key couldnt be opened
      GetStringValue = "Error"       'return Error to the user
      If DisplayErrorMsg = True Then 'if the user wants errors displayed then
         MsgBox ErrorMsg(rtn)        'tell the user what was wrong
      End If
   End If
End If

End Function

Private Sub ParseKey(Keyname As String, Keyhandle As Long)
    
rtn = InStr(Keyname, "\") 'return if "\" is contained in the Keyname

If Left(Keyname, 5) <> "HKEY_" Or Right(Keyname, 1) = "\" Then 'if the is a "\" at the end of the Keyname then
   MsgBox "Incorrect Format:" + Chr(10) + Chr(10) + Keyname 'display error to the user
   Exit Sub 'exit the procedure
ElseIf rtn = 0 Then 'if the Keyname contains no "\"
   Keyhandle = GetMainKeyHandle(Keyname)
   Keyname = "" 'leave Keyname blank
Else 'otherwise, Keyname contains "\"
   Keyhandle = GetMainKeyHandle(Left(Keyname, rtn - 1)) 'seperate the Keyname
   Keyname = Right(Keyname, Len(Keyname) - rtn)
End If

End Sub
Function CreateKey(SubKey As String)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
   rtn = RegCreateKey(MainKeyHandle, SubKey, hKey) 'create the key
   If rtn = ERROR_SUCCESS Then 'if the key was created then
      rtn = RegCloseKey(hKey)  'close the key
   End If
End If

End Function
Function SetStringValue(SubKey As String, Entry As String, Value As String)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
   rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) 'open the key
   If rtn = ERROR_SUCCESS Then 'if the key was open successfully then
      rtn = RegSetValueEx(hKey, Entry, 0, REG_SZ, ByVal Value, Len(Value)) 'write the value
      If Not rtn = ERROR_SUCCESS Then   'if there was an error writting the value
         If DisplayErrorMsg = True Then 'if the user wants errors displayed
            MsgBox ErrorMsg(rtn)        'display the error
         End If
      End If
      rtn = RegCloseKey(hKey) 'close the key
   Else 'if there was an error opening the key
      If DisplayErrorMsg = True Then 'if the user wants errors displayed
         MsgBox ErrorMsg(rtn)        'display the error
      End If
   End If
End If

End Function

Svoje najlepše dane proveo sam noću.
 
Odgovor na temu

goranvuc
Goran Vucicevic
Novi Sad

Član broj: 4934
Poruke: 1846
*.DIALUP-SMIN.neobee.net.



+41 Profil

icon Re: Odbrojavanje dana?12.10.2007. u 14:07 - pre 201 meseci
Moze i krace, naravno ostaje otvoreno da li sam te dobro razumeo, posto mi se cini da si nepotpuno postavio problem:
Code:

Private Sub Command1_Click()
   Dim datDatum As Date
   Dim datOstalo As Date
   
   'parsiranje formata datuma i dobijanje vrednosti datuma
   'podrazumeva se da je ispravno upisan datum u formatu "dd/mm/yyyy"
   datDatum = DateSerial(Val(Right(txtDatum.Text, 4)), Val(Mid(txtDatum.Text, 4, 2)), Val(Left(txtDatum.Text, 2)))
   
   'dodavanje upisanog broja dana
   datOstalo = DateAdd("d", Val(txtRok.Text), datDatum)
   
   'ispis rezultata u trazenom formatu
   txtOstalo.Text = Format(datOstalo, "dd/mm/yyyy")
   
End Sub
 
Odgovor na temu

KiselinaXP
Crna rupa

Član broj: 54030
Poruke: 232
91.191.17.*

Jabber: kiselina@elitesecurity.org
ICQ: 226466859


Profil

icon Re: Odbrojavanje dana?19.10.2007. u 08:16 - pre 201 meseci
Pozdrav svima, izvinjavam se sto nisam nista odgovarao, ali nisam bio na netu vec nekoliko dana bio sam na putu.
Ja se nisam dobro izrazio u postavljanju pitanja. Evo ovako:
U txtDatum imam datum formata dd/mm/yyyy, u txtRok su dani npr. 5,10,15,20 dana, e sada u txtDatumPlacanja se sabere txtDatum i txtRok pregled sa istim formatom dd/mm/yyyy. U txtOstaloDana svaki dan mi odbrojava koliko jos ima dana do txtOstaloDana format "dani". Valjda sam sada bio jasan.

A gde je moj moped ko da je u moravu propo!
Pero kojot genije!
 
Odgovor na temu

Marko_L
Beograd

Član broj: 20532
Poruke: 2885
89.216.223.*

Jabber: Marko_L@elitesecurity.org


+828 Profil

icon Re: Odbrojavanje dana?19.10.2007. u 09:01 - pre 201 meseci
Probaj ovako
Code:
txtDatumPlacanja.Text = CDate(txtDatum.Text) + Val(txtRok.Text)
txtOstaloDana.Text = DateDiff("d", Date, CDate(txtDatumPlacanja.Text))

-Odracuonogakomijedrpiorazmaknicu.
-Ne rxdi mi txstxturx, kxd god hocu dx
ukucxm "x" onx ukucx "x".
-Ko kaaz e da ja neuummem da kuuca
m.
-Piše "Insert disk 3", a jedva sam i ova
dva ugurao u drajv
-Postoje samo dve osobe kojima
verujem, jedna sam ja, a druga nisi ti
 
Odgovor na temu

KiselinaXP
Crna rupa

Član broj: 54030
Poruke: 232
91.191.17.*

Jabber: kiselina@elitesecurity.org
ICQ: 226466859


Profil

icon Re: Odbrojavanje dana?19.10.2007. u 10:27 - pre 201 meseci
Marko hvala ti puno to je to sto sam trazio!!!!!!!
A gde je moj moped ko da je u moravu propo!
Pero kojot genije!
 
Odgovor na temu

KiselinaXP
Crna rupa

Član broj: 54030
Poruke: 232
91.191.17.*

Jabber: kiselina@elitesecurity.org
ICQ: 226466859


Profil

icon Re: Odbrojavanje dana?19.10.2007. u 15:16 - pre 201 meseci
Sorry svima imao bih jos jedno pitanje, vezano za MSHFlexGrid?
Kada popunim tabelu kako da mi ako u polju Informacija pise "POSLATO" da mi sva polja gde pise poslato ofarba u crvenu pozadinu.
A gde je moj moped ko da je u moravu propo!
Pero kojot genije!
 
Odgovor na temu

Marko_L
Beograd

Član broj: 20532
Poruke: 2885
89.216.223.*

Jabber: Marko_L@elitesecurity.org


+828 Profil

icon Re: Odbrojavanje dana?20.10.2007. u 00:12 - pre 201 meseci
Code:
Dim i As Long
For i = 1 to MSHFlexGrid1.Rows - 1
If MSHFlexGrid1.TextMatrix(i, n) = "POSLATO" Then
MSHFlexgrid1.Row = i
MSHFlexgrid1.Col = n
MSHFlexGrid1.CellBackColor = RGB(200, 0, 0)
End If
Next i

n ti je broj kolone u kojoj hoćeš da tražiš podatak. Naravno, ovo će ti obojiti samo ćeliju u kojoj piše poslato. Ako hoćeš da obojiš ceo red onda promeni
Code:
MSHFlexgrid1.Col = n
MSHFlexGrid1.CellBackColor = RGB(200, 0, 0)

u ovo
Code:
For j = 1 to MSHFlexgrid1.Cols - 1
MSHFlexgrid1.Col = j
MSHFlexGrid1.CellBackColor = RGB(200, 0, 0)
Next j

Naravno, deklariši j negde na početku procedure. Takođe, bilo bi dobro da prilikom bojenja staviš visible i redraw svojstva grida na false radi dobijanja na brzini. Takođe, ako ne moraš, nemoj koristiti MSHFlexGrid umesto MSFlexGrida.
-Odracuonogakomijedrpiorazmaknicu.
-Ne rxdi mi txstxturx, kxd god hocu dx
ukucxm "x" onx ukucx "x".
-Ko kaaz e da ja neuummem da kuuca
m.
-Piše "Insert disk 3", a jedva sam i ova
dva ugurao u drajv
-Postoje samo dve osobe kojima
verujem, jedna sam ja, a druga nisi ti
 
Odgovor na temu

KiselinaXP
Crna rupa

Član broj: 54030
Poruke: 232
91.191.17.*

Jabber: kiselina@elitesecurity.org
ICQ: 226466859


Profil

icon Re: Odbrojavanje dana?20.10.2007. u 07:16 - pre 201 meseci
Hvala ti Marko puno, a zasto mi posle te procedure uvjek selektuje zadnje polje nece citav red?
A gde je moj moped ko da je u moravu propo!
Pero kojot genije!
 
Odgovor na temu

KiselinaXP
Crna rupa

Član broj: 54030
Poruke: 232
91.191.17.*

Jabber: kiselina@elitesecurity.org
ICQ: 226466859


Profil

icon Re: Odbrojavanje dana?26.10.2007. u 10:28 - pre 200 meseci
Imao bi jos jedno pitanje vezano za MSHFlexGrid, kako da mi npr. sestoj (6) koloni budu "ChechkBox-ovi"...
A gde je moj moped ko da je u moravu propo!
Pero kojot genije!
 
Odgovor na temu

goranvuc
Goran Vucicevic
Novi Sad

Član broj: 4934
Poruke: 1846
*.dialup.neobee.net.



+41 Profil

icon Re: Odbrojavanje dana?26.10.2007. u 17:37 - pre 200 meseci
Ne postoji predvidjeno "CheckBox" svojstvo kolone za MSFlexGrid kontrolu, tako da ti je jedina varijanta da crtas checkbox-ove - ali se bojim da je to veliki zalogaj za tebe - bez potcenjivanja.
 
Odgovor na temu

[es] :: Visual Basic 6 :: Odbrojavanje dana?

[ Pregleda: 4002 | Odgovora: 10 ] > FB > Twit

Postavi temu Odgovori

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