Sign in to follow this  
Followers 0
realkiller

database

3 posts in this topic

#1 ·  Posted (edited)

oke, i made a little database but i still stuck with 2 things.

1 iam trying to search a pc on name.normaly the hole line of company sn oem and mac go's on the same level on top but now it doesnt.

2 is it possible to make a trigger if something isnt filled in the add field

#include <GuiConstants.au3>
#include <GuiCombo.au3>
#include <File.au3>
#NoTrayIcon
$database = FileRead("pc.txt",100000000)
$database1 = FileRead("firmanaam.txt",100000000)
$database2 = FileRead("user.txt",100000000)
$database3 = FileRead("sn.txt",100000000)
$database4 = FileRead("oem.txt",100000000)
$database5 = FileRead("mac.txt",100000000)
Opt('MustDeclareVars',1)

Dim $Input,$Input1,$Input2,$Input3,$Input4,$Input5,$Btn_Insert,$Combo,$Combo1,$Combo2,$Combo3,$Combo4,$Combo5,$Btn_Exit,$msg,$Status,$i_index,$read,$read1,$read2,$read3,$read4,$read5

GuiCreate("NEA Database", 650, 768)
$Input = GuiCtrlCreateInput("", 0, 20, 50, 20);pc naam add
$Input1 = GuiCtrlCreateInput("", 51, 20, 50, 20);firma
$Input2 = GuiCtrlCreateInput("", 102, 20, 120, 20);locatie/gebruiker add
$Input3 = GuiCtrlCreateInput("", 223, 20, 120, 20);serienr add
$Input4 = GuiCtrlCreateInput("", 344, 20, 120, 20);oem add
$Input5 = GuiCtrlCreateInput("", 465, 20, 120, 20);mac add

$Btn_Insert = GuiCtrlCreateButton("Add", 600, 20, 50, 20)
GuiCtrlCreateLabel("     PC    COMPANY            USER              SN/R                   OEM                     MAC", 0, 5, 599, 11)
GuiCtrlCreateLabel("     PC    COMPANY            USER              SN/R                   OEM                     MAC", 0, 85, 599, 11)
$Combo = GuiCtrlCreateCombo("", 0, 100, 50, 60,$CBS_SIMPLE);pc naam
$Combo1 = GuiCtrlCreateCombo("", 51, 100, 50, 652,$CBS_SIMPLE);firma
$Combo2 = GuiCtrlCreateCombo("", 102, 100, 120, 652,$CBS_SIMPLE);locatie/gebruiker
$Combo3 = GuiCtrlCreateCombo("", 223, 100, 120, 652,$CBS_SIMPLE);serienr
$Combo4 = GuiCtrlCreateCombo("", 344, 100, 120, 652,$CBS_SIMPLE);oem
$Combo5 = GuiCtrlCreateCombo("", 465, 100, 120, 652,$CBS_SIMPLE);mac

GUICtrlSetData($Combo,$database)
GUICtrlSetData($Combo1,$database1)
GUICtrlSetData($Combo2,$database2)
GUICtrlSetData($Combo3,$database3)
GUICtrlSetData($Combo4,$database4)
GUICtrlSetData($Combo5,$database5)
$Status = GUICtrlCreateLabel("",0,747,1024,19,BitOR($SS_SUNKEN,$SS_CENTER))

GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE 
ExitLoop
Case $msg = $Btn_Insert
;controlle 



If(StringLen(GUICtrlRead($Input)) = 0) Then;pc naam add
msgbox(0,"", "PC naam Vergeten in te vullen")
Else
$read = GUICtrlRead($Input) 
_FileWriteToLine("pc.txt", 1, "|"&$read&"                  ", 0)
$i_index =_GUICtrlComboInsertString($Combo,_GUICtrlComboGetCurSel($Combo),GUICtrlRead($Input))
GUICtrlSetData($Status,"Database Update Afgerond Totaal: " & $i_index &" stuks")
EndIf
If(StringLen(GUICtrlRead($Input1)) = 0) Then;firma
    msgbox(0,"", "Firma Naam Vergeten in te vullen")
    Else
$read1 = GUICtrlRead($Input1) 
_FileWriteToLine("firmanaam.txt", 1, "|"&$read1&"                  ", 0)
$i_index =_GUICtrlComboInsertString($Combo1,_GUICtrlComboGetCurSel($Combo1),GUICtrlRead($Input1))
EndIf
If(StringLen(GUICtrlRead($Input2)) = 0) Then;locatie/gebruiker
        msgbox(0,"", "Locatie Vergeten in te vullen")
    Else
$read2 = GUICtrlRead($Input2) 
_FileWriteToLine("user.txt", 1, "|"&$read2&"                                      ", 0)
$i_index =_GUICtrlComboInsertString($Combo2,_GUICtrlComboGetCurSel($Combo2),GUICtrlRead($Input2))
EndIf
If(StringLen(GUICtrlRead($Input3)) = 0) Then;serienr
        msgbox(0,"", "SN/R Vergeten in te vullen")
    Else
$read3= GUICtrlRead($Input3) 
_FileWriteToLine("sn.txt", 1, "|"&$read3&"                                    ", 0)
$i_index =_GUICtrlComboInsertString($Combo3,_GUICtrlComboGetCurSel($Combo3),GUICtrlRead($Input3))
EndIf
If(StringLen(GUICtrlRead($Input4)) = 0) Then;oem
        msgbox(0,"", "OEM vergeten in te vullen")
    Else
$read4 = GUICtrlRead($Input4) 
_FileWriteToLine("oem.txt", 1, "|"&$read4&"                                   ", 0)
$i_index =_GUICtrlComboInsertString($Combo4,_GUICtrlComboGetCurSel($Combo4),GUICtrlRead($Input4))
EndIf
If(StringLen(GUICtrlRead($Input5)) = 0) Then;mac
        msgbox(0,"", "MAC vergeten in te vullen")
    Else
$read5 = GUICtrlRead($Input5) 
_FileWriteToLine("mac.txt", 1, "|"&$read5&"                                   ", 0)
$i_index =_GUICtrlComboInsertString($Combo5,_GUICtrlComboGetCurSel($Combo5),GUICtrlRead($Input5))
EndIf





EndSelect
WEnd
Edited by realkiller

Share this post


Link to post
Share on other sites



oke i finished the trigger asswell now only 1

#include <GuiConstants.au3>
#include <GuiCombo.au3>
#include <File.au3>
#NoTrayIcon
$database = FileRead("pc.txt",100000000)
$database1 = FileRead("firmanaam.txt",100000000)
$database2 = FileRead("user.txt",100000000)
$database3 = FileRead("sn.txt",100000000)
$database4 = FileRead("oem.txt",100000000)
$database5 = FileRead("mac.txt",100000000)
Opt('MustDeclareVars',1)

Dim $Input,$Input1,$Input2,$Input3,$Input4,$Input5,$Btn_Insert,$Combo,$Combo1,$Combo2,$Combo3,$Combo4,$Combo5,$Btn_Exit,$msg,$Status,$i_index,$read,$read1,$read2,$read3,$read4,$read5

GuiCreate("NEA Database", 650, 768)
$Input = GuiCtrlCreateInput("", 0, 20, 50, 20);pc naam add
$Input1 = GuiCtrlCreateInput("", 51, 20, 50, 20);firma
$Input2 = GuiCtrlCreateInput("", 102, 20, 120, 20);locatie/gebruiker add
$Input3 = GuiCtrlCreateInput("", 223, 20, 120, 20);serienr add
$Input4 = GuiCtrlCreateInput("", 344, 20, 120, 20);oem add
$Input5 = GuiCtrlCreateInput("", 465, 20, 120, 20);mac add

$Btn_Insert = GuiCtrlCreateButton("Add", 600, 20, 50, 20)
GuiCtrlCreateLabel("     PC    COMPANY            USER              SN/R                   OEM                     MAC", 0, 5, 599, 11)
GuiCtrlCreateLabel("     PC    COMPANY            USER              SN/R                   OEM                     MAC", 0, 85, 599, 11)
$Combo = GuiCtrlCreateCombo("", 0, 100, 50, 60,$CBS_SIMPLE);pc naam
$Combo1 = GuiCtrlCreateCombo("", 51, 100, 50, 652,$CBS_SIMPLE);firma
$Combo2 = GuiCtrlCreateCombo("", 102, 100, 120, 652,$CBS_SIMPLE);locatie/gebruiker
$Combo3 = GuiCtrlCreateCombo("", 223, 100, 120, 652,$CBS_SIMPLE);serienr
$Combo4 = GuiCtrlCreateCombo("", 344, 100, 120, 652,$CBS_SIMPLE);oem
$Combo5 = GuiCtrlCreateCombo("", 465, 100, 120, 652,$CBS_SIMPLE);mac

GUICtrlSetData($Combo,$database)
GUICtrlSetData($Combo1,$database1)
GUICtrlSetData($Combo2,$database2)
GUICtrlSetData($Combo3,$database3)
GUICtrlSetData($Combo4,$database4)
GUICtrlSetData($Combo5,$database5)
$Status = GUICtrlCreateLabel("",0,747,1024,19,BitOR($SS_SUNKEN,$SS_CENTER))

GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE 
ExitLoop
Case $msg = $Btn_Insert
;controlle 


while 1

If(StringLen(GUICtrlRead($Input)) = 0) Then
    msgbox(0,"", "PC naam Vergeten in te vullen")
    ExitLoop
    EndIf
    If(StringLen(GUICtrlRead($Input1)) = 0) Then
    msgbox(0,"", "Firma Naam Vergeten in te vullen")
    ExitLoop
        EndIf
    If(StringLen(GUICtrlRead($Input2)) = 0) Then
        msgbox(0,"", "Locatie Vergeten in te vullen")
    ExitLoop
        EndIf
    If(StringLen(GUICtrlRead($Input3)) = 0) Then
        msgbox(0,"", "SN/R Vergeten in te vullen")
    ExitLoop
        EndIf
    If(StringLen(GUICtrlRead($Input)) = 4) Then
        msgbox(0,"", "OEM vergeten in te vullen")
    ExitLoop
        EndIf
    If(StringLen(GUICtrlRead($Input5)) = 0) Then
        msgbox(0,"", "MAC vergeten in te vullen")
    ExitLoop
        EndIf
    
    
;controlle  
    
If(StringLen(GUICtrlRead($Input)) = 0) Then;pc naam add
Else
$read = GUICtrlRead($Input) 
_FileWriteToLine("pc.txt", 1, "|"&$read&"                  ", 0)
$i_index =_GUICtrlComboInsertString($Combo,_GUICtrlComboGetCurSel($Combo),GUICtrlRead($Input))
GUICtrlSetData($Status,"Database Update Afgerond Totaal: " & $i_index &" stuks")
EndIf

If(StringLen(GUICtrlRead($Input1)) = 0) Then;firma  
    Else
$read1 = GUICtrlRead($Input1) 
_FileWriteToLine("firmanaam.txt", 1, "|"&$read1&"                  ", 0)
$i_index =_GUICtrlComboInsertString($Combo1,_GUICtrlComboGetCurSel($Combo1),GUICtrlRead($Input1))
EndIf

If(StringLen(GUICtrlRead($Input2)) = 0) Then;locatie/gebruiker
Else
$read2 = GUICtrlRead($Input2) 
_FileWriteToLine("user.txt", 1, "|"&$read2&"                                      ", 0)
$i_index =_GUICtrlComboInsertString($Combo2,_GUICtrlComboGetCurSel($Combo2),GUICtrlRead($Input2))
EndIf

If(StringLen(GUICtrlRead($Input3)) = 0) Then;serienr
    Else
$read3= GUICtrlRead($Input3) 
_FileWriteToLine("sn.txt", 1, "|"&$read3&"                                    ", 0)
$i_index =_GUICtrlComboInsertString($Combo3,_GUICtrlComboGetCurSel($Combo3),GUICtrlRead($Input3))
EndIf


If(StringLen(GUICtrlRead($Input4)) = 0) Then;oem
    Else
$read4 = GUICtrlRead($Input4) 
_FileWriteToLine("oem.txt", 1, "|"&$read4&"                                   ", 0)
$i_index =_GUICtrlComboInsertString($Combo4,_GUICtrlComboGetCurSel($Combo4),GUICtrlRead($Input4))
EndIf

If(StringLen(GUICtrlRead($Input5)) = 0) Then;mac
    Else
$read5 = GUICtrlRead($Input5) 
_FileWriteToLine("mac.txt", 1, "|"&$read5&"                                   ", 0)
$i_index =_GUICtrlComboInsertString($Combo5,_GUICtrlComboGetCurSel($Combo5),GUICtrlRead($Input5))
EndIf
ExitLoop
WEnd
 
    







        






EndSelect
WEnd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0