Click here to Skip to main content
16,010,114 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Web user control Creation Pin
Sandeep Akhare18-Sep-08 2:11
Sandeep Akhare18-Sep-08 2:11 
GeneralRe: Web user control Creation Pin
omlac18-Sep-08 2:59
omlac18-Sep-08 2:59 
GeneralRe: Web user control Creation Pin
Sandeep Akhare18-Sep-08 3:03
Sandeep Akhare18-Sep-08 3:03 
GeneralRe: Web user control Creation Pin
omlac18-Sep-08 3:19
omlac18-Sep-08 3:19 
QuestionAn error occurs when an extra parameter is increased in application as well as stored procedure to the existing one Pin
sanjubaba17-Sep-08 23:12
sanjubaba17-Sep-08 23:12 
AnswerRe: An error occurs when an extra parameter is increased in application as well as stored procedure to the existing one Pin
eyeseetee17-Sep-08 23:21
eyeseetee17-Sep-08 23:21 
GeneralRe: An error occurs when an extra parameter is increased in application as well as stored procedure to the existing one [modified] Pin
sanjubaba18-Sep-08 0:46
sanjubaba18-Sep-08 0:46 
Questiondetection of card reader Pin
Piyush Vardhan Singh17-Sep-08 23:01
Piyush Vardhan Singh17-Sep-08 23:01 
i have writing code detection(insertion and remove) of card reader.its work properly and it detect usb and card reader both drive.
There any property to detect it Usb or Card reader?
Please Help Me//
thanks
CODE:=
Private WithEvents m_MediaConnectWatcher As ManagementEventWatcher
Public USBDriveLetter As String
Dim StrStatus As String
Public USBDriveName As String
Dim _ReaderSetting As Settings

Public Sub StartDetection()
Try
' __InstanceOperationEvent will trap both Creation and Deletion of class instances
Dim query2 As New WqlEventQuery("SELECT * FROM __InstanceOperationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_DiskDrive'")
m_MediaConnectWatcher = New ManagementEventWatcher
m_MediaConnectWatcher.Query = query2
m_MediaConnectWatcher.Start()
Catch ex As Exception

End Try
End Sub

///////
Private Sub m_MediaConnectWatcher_EventArrived(ByVal sender As Object, ByVal e As System.Management.EventArrivedEventArgs) Handles m_MediaConnectWatcher.EventArrived
Try
Dim mbo, obj As ManagementBaseObject
' the first thing we have to do is figure out if this is a creation or deletion event
mbo = CType(e.NewEvent, ManagementBaseObject)
' next we need a copy of the instance that was either created or deleted
obj = CType(mbo("TargetInstance"), ManagementBaseObject)

Select Case mbo.ClassPath.ClassName
Case "__InstanceCreationEvent"
If obj("InterfaceType") = "USB" Then
StrStatus = StrStatus + obj("Caption") & " (Drive letter " & GetDriveLetterFromDisk(obj("Name")) & ") has been plugged in" + vbCrLf
Else
StrStatus = StrStatus + obj("InterfaceType") + vbCrLf
End If
Case "__InstanceDeletionEvent"
If obj("InterfaceType") = "USB" Then
StrStatus = StrStatus + obj("Caption") & " has been unplugged" + vbCrLf
If obj("Caption") = USBDriveName Then
USBDriveLetter = ""
USBDriveName = ""
End If
Else
StrStatus = StrStatus + obj("InterfaceType") + vbCrLf
End If '__InstanceModificationEvent
Case "__InstanceModificationEvent"
Dim Str As String = GetDriveLetterFromDisk(obj("Name"))
If obj("InterfaceType") = "USB" And Not Str = "" Then
StrStatus = StrStatus + obj("Caption") & " (Drive letter " & Str & ") has been plugged in" + vbCrLf
Else
StrStatus = StrStatus + obj("Caption") & " has been unplugged" + vbCrLf
End If
Case Else
MsgBox("nope: " & obj("Caption"))
End Select
MsgBox(StrStatus)

Catch ex As Exception

End Try
End Sub
Private Function GetDriveLetterFromDisk(ByVal Name As String) As String
Try
Dim oq_part, oq_disk As ObjectQuery
Dim mos_part, mos_disk As ManagementObjectSearcher
Dim obj_part, obj_disk As ManagementObject
Dim ans As String = ""
' WMI queries use the "\" as an escape charcter
Name = Replace(Name, "\", "\\")
' First we map the Win32_DiskDrive instance with the association called
' Win32_DiskDriveToDiskPartition. Then we map the Win23_DiskPartion
' instance with the assocation called Win32_LogicalDiskToPartition
oq_part = New ObjectQuery("ASSOCIATORS OF {Win32_DiskDrive.DeviceID=""" & Name & """} WHERE AssocClass = Win32_DiskDriveToDiskPartition")
mos_part = New ManagementObjectSearcher(oq_part)
For Each obj_part In mos_part.Get()
oq_disk = New ObjectQuery("ASSOCIATORS OF {Win32_DiskPartition.DeviceID=""" & obj_part("DeviceID") & """} WHERE AssocClass = Win32_LogicalDiskToPartition")
mos_disk = New ManagementObjectSearcher(oq_disk)
For Each obj_disk In mos_disk.Get()
ans &= obj_disk("Name") & ","
Next
Next
Return ans.Trim(","c)
Catch ex As Exception
Return Nothing
End Try
End Function


Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com



Question.Net Application with multiple languages Pin
surender93917-Sep-08 22:59
surender93917-Sep-08 22:59 
AnswerRe: .Net Application with multiple languages Pin
balaji.t17-Sep-08 23:12
balaji.t17-Sep-08 23:12 
GeneralRe: .Net Application with multiple languages Pin
surender93917-Sep-08 23:16
surender93917-Sep-08 23:16 
GeneralRe: .Net Application with multiple languages PinPopular
J4amieC17-Sep-08 23:32
J4amieC17-Sep-08 23:32 
GeneralRe: .Net Application with multiple languages Pin
eyeseetee17-Sep-08 23:42
eyeseetee17-Sep-08 23:42 
GeneralRe: .Net Application with multiple languages [modified] Pin
Pete O'Hanlon18-Sep-08 0:36
mvePete O'Hanlon18-Sep-08 0:36 
GeneralRe: .Net Application with multiple languages Pin
J4amieC18-Sep-08 1:08
J4amieC18-Sep-08 1:08 
Questionhow i use checkboxlist in Asp.net 2005 Pin
gautamamit817-Sep-08 22:51
gautamamit817-Sep-08 22:51 
AnswerRe: how i use checkboxlist in Asp.net 2005 Pin
eyeseetee17-Sep-08 22:57
eyeseetee17-Sep-08 22:57 
Questionusing oracle client server Pin
brettokumar17-Sep-08 22:46
professionalbrettokumar17-Sep-08 22:46 
Questioncann't set radiobuttonlist.item(0).selected=true in multiview [modified] Pin
Mhiny17-Sep-08 22:36
Mhiny17-Sep-08 22:36 
AnswerRe: cann't set radiobuttonlist.item(0).selected=true in multiview Pin
eyeseetee17-Sep-08 22:55
eyeseetee17-Sep-08 22:55 
GeneralRe: cann't set radiobuttonlist.item(0).selected=true in multiview Pin
Mhiny17-Sep-08 23:15
Mhiny17-Sep-08 23:15 
GeneralRe: cann't set radiobuttonlist.item(0).selected=true in multiview Pin
eyeseetee17-Sep-08 23:23
eyeseetee17-Sep-08 23:23 
QuestionMouse Move and Click application help Pin
Vaibhav Saran17-Sep-08 21:36
Vaibhav Saran17-Sep-08 21:36 
Questionhow to display message and redirect to another page Pin
imranafsari17-Sep-08 21:33
imranafsari17-Sep-08 21:33 
AnswerRe: how to display message and redirect to another page Pin
eyeseetee17-Sep-08 22:17
eyeseetee17-Sep-08 22:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.