CLEARDATEPICKER

If you want to call, you can use this script.

if IsDBNull(DataGridView1.CurrentRow.Cells(17).Value) Then
ClearDatePicker(dtSold)
Else
dtSold.Text = DataGridView1.CurrentRow.Cells(17).Value
End If

This is procedure or function.

Private Sub ClearDatePicker(ByVal DatePicker As DateTimePicker)

DatePicker.CustomFormat = ” ”

DatePicker.Format = DateTimePickerFormat.Custom

End Sub

EXPORT TO EXCEL

Imports Excel = Microsoft.Office.Interop.Excel

Imports System.Security.Cryptography

Try

‘Make Connection

strCon =

modDataSource.strCon_Online

Dim cnn As New SqlConnection(strCon)

‘ Variable

Dim i, j As Integer

‘Excel WorkBook object

Dim xlApp As Microsoft.Office.Interop.Excel.Application

Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook

Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet

Dim misValue As Object = System.Reflection.Missing.Value

xlApp =

New Microsoft.Office.Interop.Excel.ApplicationClass

xlWorkBook = xlApp.Workbooks.Add(misValue)

‘ Sheet Name or Number

xlWorkSheet = xlWorkBook.Sheets(

“sheet1”)

‘ Sql QUery

‘ xlWorkBook.Sheets.Select(“A1:A2”)

Dim sql As String = “select [TruckNumber],[1stWeight],[1stWeightDate],[2ndWeight],[2ndWeightDate]” _

&

“,([2ndWeight]-[1stWeight]) as [Bruto],[SlipNumber],[DespatchDate],[DeliveryNumber]” _

&

“,[MaterialNumber],[MaterialDescription],[CustomerNumber],[CustomerName],[Driver],[Note]” _

&

” from PublicDespatch where [dbo].MidnightOf([DespatchDate]) >= ‘” & Format(dtDespatchDateStart.Value, “yyyy-MM-dd”) & “‘ and “ _

&

” [dbo].MidnightOf([DespatchDate]) <= ‘” & Format(dtDespatchDateEnd.Value, “yyyy-MM-dd”) & “‘ and “ _

&

” [WeighBridgeNum] = ‘” & modFunction.gcWeighBridgeNum & “‘”

‘ SqlAdapter

Dim dscmd As New SqlDataAdapter(sql, cnn.ConnectionString)

‘ DataSet

Dim ds As New DataSet

dscmd.Fill(ds)

‘COLUMN NAME ADD IN EXCEL SHEET OR HEADING

xlWorkSheet.Cells(1, 1).Value =

“Number”

xlWorkSheet.Cells(1, 2).Value =

“Truck Number”

xlWorkSheet.Cells(1, 3).Value =

“First Weight”

xlWorkSheet.Cells(1, 4).Value =

“First Weight Date”

xlWorkSheet.Cells(1, 5).Value =

“Second Weight”

xlWorkSheet.Cells(1, 6).Value =

“Second Weight Date”

xlWorkSheet.Cells(1, 7).Value =

“Bruto”

xlWorkSheet.Cells(1, 8).Value =

“Slip Number”

xlWorkSheet.Cells(1, 9).Value =

“Despatch Date”

xlWorkSheet.Cells(1, 10).Value =

“Delivery Number”

xlWorkSheet.Cells(1, 11).Value =

“Material Number”

xlWorkSheet.Cells(1, 12).Value =

“Material Description”

xlWorkSheet.Cells(1, 13).Value =

“Customer Number”

xlWorkSheet.Cells(1, 14).Value =

“Customer Name”

xlWorkSheet.Cells(1, 15).Value =

“Driver”

xlWorkSheet.Cells(1, 16).Value =

“Note”

‘ SQL Table Transfer to Excel

For i = 0 To ds.Tables(0).Rows.Count – 1

‘Column

For j = 0 To ds.Tables(0).Columns.Count – 1

‘ this i change to header line cells >>>

If j = 0 Then

xlWorkSheet.Cells(i + 2, j + 1) = i + 1

xlWorkSheet.Cells(i + 2, j + 2) = ds.Tables(0).Rows(i).Item(j)

Else

xlWorkSheet.Cells(i + 2, j + 2) = ds.Tables(0).Rows(i).Item(j)

End If

Next

lblCounter.Text = Trim(Str(i + 1))

Next

‘HardCode in Excel sheet

‘ this i change to footer line cells >>>

xlWorkSheet.Cells(i + 3, 6) =

“Total”

Dim str1 As String = “=SUM(G2:G” & Trim(Str(i + 1)) & “)”

xlWorkSheet.Cells.Item(i + 3, 7) = str1

‘ Save as path of excel sheet

Dim namefile As String = “publicdespatch” & Format(dtDespatchDateStart.Value, “yyyyMMdd”) & “_” & Replace(Trim(Str(RandomGenerator())), “-“, “”)

xlWorkSheet.SaveAs(

“C:\Export\” & namefile & “.xlsx”)

xlWorkBook.Close()

xlApp.Quit()

releaseObject(xlApp)

releaseObject(xlWorkBook)

releaseObject(xlWorkSheet)

‘Msg Box of Excel Sheet Path

MsgBox(

“You can find the file C:\Export\” & namefile & “.xlsx”)

Catch ex As Exception

MsgBox(

“You can’t find data in your choose”)

End Try

Private Sub releaseObject(ByVal obj As Object)

Try

System.Runtime.InteropServices.

Marshal.ReleaseComObject(obj)

obj =

Nothing

Catch ex As Exception

obj =

Nothing

Finally

GC.Collect()

End Try

End Sub

Public Function RandomGenerator() As Integer

Dim byteCount As Byte() = New Byte(6) {}

Dim randomNumber As New RNGCryptoServiceProvider()

randomNumber.GetBytes(byteCount)

Return BitConverter.ToInt32(byteCount, 0)

End Function

and don’t forget to put “Microsoft Excel 15.0 Object Library” in references.

C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll

FOLDERBROWSERDIALOG BOX IN VB.NET

A FolderBrowserDialog control is used to browse and select a folder on a computer.

Private Sub btnBrowse_Click(sender As Object, e As EventArgs) Handles btnBrowse.Click
Dim folderDlg As New FolderBrowserDialog
folderDlg.ShowNewFolderButton = True
If (folderDlg.ShowDialog() = DialogResult.OK) Then
txtDir.Text = folderDlg.SelectedPath
Dim root As Environment.SpecialFolder = folderDlg.RootFolder
End If
End Sub

Close application at Android Studio

We can close application with this script in android studio.

import android.view.View.OnClickListener;
buttonClose = (Button) findViewById(R.id.btnClose);
buttonClose.setOnClickListener(new OnClickListener() {
 @Override
 public void onClick(View arg0) {
 // TODO Auto-generated method stub
 Intent intent = new Intent(Intent.ACTION_MAIN);
 intent.addCategory(Intent.CATEGORY_HOME);
 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 startActivity(intent);
 finish();
 System.exit(0);
 }

});


Android Studio

Android Studio, yah this one is Android application development.

Android Studio is an integrated development environment (IDE) for developing for the Android platform. It was announced on May 16, 2013 at the Google I/O conference by Google‘s Product Manager, Katherine Chou. Android Studio is freely available under the Apache License 2.0.[3]

Android Studio was in early access preview stage starting from version 0.1 in May 2013, then entered beta stage starting from version 0.8 which was released in June 2014.[4] The first stable build was released in December 2014, starting from version 1.0.[5]

Based on JetBrainsIntelliJ IDEA software, Android Studio is designed specifically for Android development.[6] It is available for download on Windows, Mac OS X and Linux,[7][8] and replaced Eclipse Android Development Tools (ADT) as Google’s primary IDE for native Android application development.

location.assign

If you want to direct the other link in your website.

<!DOCTYPE html>
<html>
<body>
<script>
location.assign(“http://www.siswoyo.web.id/2015/”);
</script>

</body>
</html>

Replacing Battery UPS Liebert PSA 1000 MT3

ups

To replace the battery:
1. Turn off all connected loads, then turn off the UPS (batteries are NOT
hot-swappable).
2. Use a Phillips head screwdriver to remove the two top cover screws from
the back of the UPS.
3. Slide the top panel backward 1/2″ (13mm). Slide the front panel upward,
then pull outward to remove it.
4. Gently pull the batteries out of the UPS.
5. Remove the black wire from the negative (-) terminal and the red wire from the positive (+) terminal.
Don’t forget to remove the two front cover screws from the bottom of the UPS.