Private Sub TreeView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then ' Signal a Drag operation.
Draging = True ' Set the flag to true.
' Set the drag icon with the CreateDragImage method.
TreeView1.Drag vbBeginDrag ' Drag operation.
End If
End Sub
Private Sub TreeView1_DragOver(Source As Control, x As Single, y As Single, State As Integer)
If Draging = True Then
' Set DropHighlight to the mouse's coordinates.
Set TreeView1.DropHighlight = TreeView1.HitTest(x, y)
End If
End Sub
Private Sub gridMail_DragDrop(Source As Control, x As Single, y As Single)
Set nodoScelto = TreeView1.SelectedItem
'se il nodo è livello 3 significa che è un fornitore e quindi lo inserisce subito in lista
If livelloNodo(nodoScelto) = 3 Then
aggiungiInGridMail nodoScelto.Text
End If
End Sub
venerdì 11 aprile 2014
lunedì 31 marzo 2014
riportare il contenuto di una tabella mysql in php
<?php
$query = "SELECT * FROM `miatabella` ";
$risultato = mysql_query($query) or die("Query fallita: " . mysql_error() );
$numcampi = mysql_num_fields($risultato);
echo "<table class='tabZebra' border='1'><tr>";
for ($i=0; $i < $numcampi; $i++) {
echo '<th>'.mysql_field_name($risultato, $i).'</th>';
}
echo "</tr>";
while ($row = mysql_fetch_row($risultato)) {
echo '<tr><td>'.implode($row,'</td><td>')."</td></tr>";
}
echo "</table>";
?>
$query = "SELECT * FROM `miatabella` ";
$risultato = mysql_query($query) or die("Query fallita: " . mysql_error() );
$numcampi = mysql_num_fields($risultato);
echo "<table class='tabZebra' border='1'><tr>";
for ($i=0; $i < $numcampi; $i++) {
echo '<th>'.mysql_field_name($risultato, $i).'</th>';
}
echo "</tr>";
while ($row = mysql_fetch_row($risultato)) {
echo '<tr><td>'.implode($row,'</td><td>')."</td></tr>";
}
echo "</table>";
?>
giovedì 13 marzo 2014
jquery, nascondere colonne
vedi il link
http://www.devcurry.com/2009/07/hide-table-column-with-single-line-of.html
http://www.devcurry.com/2009/07/hide-table-column-with-single-line-of.html
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="Scripts/jquery-1.3.2.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $('#btnHide').click(function() { $('td:nth-child(2)').hide(); // if your table has header(th), use this //$('td:nth-child(2),th:nth-child(2)').hide(); }); }); </script> </head> <body> <table id="tableone" border="1"> <tr class="del"> <td>Row 0 Column 0</td> <td >Row 0 Column 1</td> <td >Row 0 Column 2</td> </tr> <tr class="del"> <td>Row 1 Column 0</td> <td>Row 1 Column 1</td> <td>Row 1 Column 2</td> </tr> <tr class="del"> <td>Row 2 Column 0</td> <td>Row 2 Column 1</td> <td>Row 2 Column 2</td> </tr> <tr class="del"> <td>Row 3 Column 0</td> <td>Row 3 Column 1</td> <td>Row 3 Column 2</td> </tr> <tr class="del"> <td>Row 4 Column 0</td> <td>Row 4 Column 1</td> <td>Row 4 Column 2</td> </tr> <tr class="del"> <td>Row 5 Column 0</td> <td>Row 5 Column 1</td> <td>Row 5 Column 2</td> </tr> </table> <input id="btnHide" type="button" value="Hide Column 2"/> </body> </html>
lunedì 10 marzo 2014
Inviare una mail outlook con VB6
Private Sub inviaMail()
Dim OutApp As Object
Dim OutMail As Object
Dim nomefiledaallegare As String
Dim testoMail As String
Dim FIRME As String
Dim SIGNATURE As String
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
FIRME = "C:\Documents and Settings\XXXXXXXXXXXXXXXXXXX\Dati applicazioni\Microsoft\Firme elettroniche\xxxxxx.htm"
If Dir(FIRME) <> "" Then
SIGNATURE = GetBoiler(FIRME)
Else
SIGNATURE = ""
End If
testoMail = "<html><head></head><body>"
testoMail = testoMail & "Ciao<br>"
testoMail = testoMail & "Prova invio mail da outlook con VB6."
testoMail = testoMail & "</body></html>" & " " & SIGNATURE
On Error Resume Next
With OutMail
.display
.To = "destinatario@itn.it"
.CC = ""
.BCC = ""
.Subject = "Prova invio mail da outlook con VB6."
.HTMLbody = testoMail
.Attachments.Add nomeFile
'.send
.Readreceiptrequested = False
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Private Sub Command1_Click()
inviaMail
End Sub
Function GetBoiler(ByVal sFile As String) As String
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
GetBoiler = ts.readall
ts.Close
End Function
Dim OutApp As Object
Dim OutMail As Object
Dim nomefiledaallegare As String
Dim testoMail As String
Dim FIRME As String
Dim SIGNATURE As String
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
FIRME = "C:\Documents and Settings\XXXXXXXXXXXXXXXXXXX\Dati applicazioni\Microsoft\Firme elettroniche\xxxxxx.htm"
If Dir(FIRME) <> "" Then
SIGNATURE = GetBoiler(FIRME)
Else
SIGNATURE = ""
End If
testoMail = "<html><head></head><body>"
testoMail = testoMail & "Ciao<br>"
testoMail = testoMail & "Prova invio mail da outlook con VB6."
testoMail = testoMail & "</body></html>" & " " & SIGNATURE
On Error Resume Next
With OutMail
.display
.To = "destinatario@itn.it"
.CC = ""
.BCC = ""
.Subject = "Prova invio mail da outlook con VB6."
.HTMLbody = testoMail
.Attachments.Add nomeFile
'.send
.Readreceiptrequested = False
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Private Sub Command1_Click()
inviaMail
End Sub
Function GetBoiler(ByVal sFile As String) As String
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
GetBoiler = ts.readall
ts.Close
End Function
mercoledì 5 marzo 2014
tabella pivot con PHP
<?php
$connessione = mysql_connect("localhost", "root", "") or die("Connessione non riuscita: " . mysql_error()); //connessione al server
mysql_select_db("andrea") or die("Selezione del database non riuscita");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<title>Barra degli strumenti</title>
<style>
div {
float:left;
border-style:solid;
border-width:1px;
margin:5px;
padding:5px;
}
</style>
</head>
<body>
<?php
function tabellaPivot($tabella, $intestRig, $intestCol, $funzione, $valore) {
//inizializza intestazioni
$arrayRig = array() ;
$arrayCol = array() ;
//trova gli array delle intestazioni
//..per quanto riguarda le RIGHE..
$query = "SELECT DISTINCT $intestRig from $tabella order by $intestRig ";
$risultato = mysql_query($query) or die("Query fallita: " . mysql_error() );
while ( $riga = mysql_fetch_array($risultato, MYSQL_ASSOC) ) {
array_push($arrayRig, $riga[$intestRig] );
}
//..per quanto riguarda le COLONNE..
$query = "SELECT DISTINCT $intestCol from $tabella order by $intestCol ";
$risultato = mysql_query($query) or die("Query fallita: " . mysql_error() );
while ( $riga = mysql_fetch_array($risultato, MYSQL_ASSOC) ) {
array_push($arrayCol, $riga[$intestCol] );
}
//inizia a riportare i dati in formato tabellare
echo ("<table border='1'>") ;
//riporta intestazioni di colonna
echo "<tr>";
echo "<td></td>";
foreach ($arrayCol as $valueCol) {
echo ("<td>$valueCol</td>") ;
}
echo "</tr>";
//riporta le RIGHE (intestazioni e dati)
foreach ($arrayRig as $valueRig) {
echo "<tr>";
echo ("<td>$valueRig</td>") ;
foreach ($arrayCol as $valueCol) {
$query = "SELECT $funzione($valore) as tot from $tabella where $intestRig = '$valueRig' and $intestCol = '$valueCol' ";
$risultato = mysql_query($query) or die("Query fallita: " . mysql_error() );
$riga = mysql_fetch_array($risultato, MYSQL_ASSOC) ;
echo ("<td>" . $riga['tot'] . "</td>") ;
}
echo "</tr>";
}
echo ("</table>") ;
}
?>
<div class="stack2">
<?php
echo "<div>" ;
tabellaPivot ("provaPivot",$intestRig ='mese',$intestCol ='anno',$funzione = 'count',$valore = 'accessi');
echo "</div>" ;echo "<div>" ;
tabellaPivot ("provaPivot",$intestRig ='mese',$intestCol ='anno',$funzione = 'sum',$valore = 'accessi');
echo "</div>" ;echo "<div>" ;
tabellaPivot ("provaPivot",$intestRig ='mese',$intestCol ='anno',$funzione = 'max',$valore = 'accessi');
echo "</div>" ;echo "<div>" ;
tabellaPivot ("provaPivot",$intestRig ='mese',$intestCol ='anno',$funzione = 'min',$valore = 'accessi');
echo "</div>" ;echo "<div>" ;
tabellaPivot ("provaPivot",$intestRig ='mese',$intestCol ='anno',$funzione = 'avg',$valore = 'accessi');
echo "</div>" ;
?>
</div>
</body>
</html>
$connessione = mysql_connect("localhost", "root", "") or die("Connessione non riuscita: " . mysql_error()); //connessione al server
mysql_select_db("andrea") or die("Selezione del database non riuscita");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<title>Barra degli strumenti</title>
<style>
div {
float:left;
border-style:solid;
border-width:1px;
margin:5px;
padding:5px;
}
</style>
</head>
<body>
<?php
function tabellaPivot($tabella, $intestRig, $intestCol, $funzione, $valore) {
//inizializza intestazioni
$arrayRig = array() ;
$arrayCol = array() ;
//trova gli array delle intestazioni
//..per quanto riguarda le RIGHE..
$query = "SELECT DISTINCT $intestRig from $tabella order by $intestRig ";
$risultato = mysql_query($query) or die("Query fallita: " . mysql_error() );
while ( $riga = mysql_fetch_array($risultato, MYSQL_ASSOC) ) {
array_push($arrayRig, $riga[$intestRig] );
}
//..per quanto riguarda le COLONNE..
$query = "SELECT DISTINCT $intestCol from $tabella order by $intestCol ";
$risultato = mysql_query($query) or die("Query fallita: " . mysql_error() );
while ( $riga = mysql_fetch_array($risultato, MYSQL_ASSOC) ) {
array_push($arrayCol, $riga[$intestCol] );
}
//inizia a riportare i dati in formato tabellare
echo ("<table border='1'>") ;
//riporta intestazioni di colonna
echo "<tr>";
echo "<td></td>";
foreach ($arrayCol as $valueCol) {
echo ("<td>$valueCol</td>") ;
}
echo "</tr>";
//riporta le RIGHE (intestazioni e dati)
foreach ($arrayRig as $valueRig) {
echo "<tr>";
echo ("<td>$valueRig</td>") ;
foreach ($arrayCol as $valueCol) {
$query = "SELECT $funzione($valore) as tot from $tabella where $intestRig = '$valueRig' and $intestCol = '$valueCol' ";
$risultato = mysql_query($query) or die("Query fallita: " . mysql_error() );
$riga = mysql_fetch_array($risultato, MYSQL_ASSOC) ;
echo ("<td>" . $riga['tot'] . "</td>") ;
}
echo "</tr>";
}
echo ("</table>") ;
}
?>
<div class="stack2">
<?php
echo "<div>" ;
tabellaPivot ("provaPivot",$intestRig ='mese',$intestCol ='anno',$funzione = 'count',$valore = 'accessi');
echo "</div>" ;echo "<div>" ;
tabellaPivot ("provaPivot",$intestRig ='mese',$intestCol ='anno',$funzione = 'sum',$valore = 'accessi');
echo "</div>" ;echo "<div>" ;
tabellaPivot ("provaPivot",$intestRig ='mese',$intestCol ='anno',$funzione = 'max',$valore = 'accessi');
echo "</div>" ;echo "<div>" ;
tabellaPivot ("provaPivot",$intestRig ='mese',$intestCol ='anno',$funzione = 'min',$valore = 'accessi');
echo "</div>" ;echo "<div>" ;
tabellaPivot ("provaPivot",$intestRig ='mese',$intestCol ='anno',$funzione = 'avg',$valore = 'accessi');
echo "</div>" ;
?>
</div>
</body>
</html>
lunedì 3 febbraio 2014
[VB6] riportare su una lista le sottocartelle di una directoyry
prerequisiti
bisogna attivare tra i riferimenti "Micrisoft scritpting runtime"codice
Private Sub listaSubDir(ByVal dirIniziale As String, ByVal listaDestinazione As ListBox, ByVal togliInizio As Integer)Dim fso As New FileSystemObject
Dim Directory As Folder
Dim SubDirs As Folder
Set Directory = fso.GetFolder(dirIniziale)
For Each SubDirs In Directory.SubFolders
listaDestinazione.AddItem Mid(SubDirs.Path, togliInizio + 1), 0
listaSubDir dirIniziale & "\" & SubDirs.Name, listaDestinazione, togliInizio
Next
End Sub
lunedì 20 gennaio 2014
excel, formatto numero personalizzato
http://office.microsoft.com/it-it/excel-help/creare-o-eliminare-un-formato-di-numero-personalizzato-HP001216503.aspx
Iscriviti a:
Post (Atom)