|
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
|
|
|
|
|
Hi friends,
Can anyone help me in developing application with multiple language support.
we can make use of resource files but
whether to use gloabal resource or local resource pls suggest me.
My application is having 15 pages , and m using master pages.
And i want to know how to use java script with multiple languages.
Any help can be appreciated.
regards,
|
|
|
|
|
hi,
use global resource file.(extension .resx).there u have name and value.in the name give the name of ur control and in value the language by which u r calling that control.for.eg u have empname as name give some value for that like Employeename and call it in codebehind like
txtempName.text=Resources.<resourcefilename>.empname
T.Balaji
|
|
|
|
|
Thanks balaji,
m using global resource file as u said, but
how abt java script , i hav written some java script functions how to make them dynamic depending on language.
thanks inadvance.
|
|
|
|
|
cd is ezr 2 rite if u fix ths mssng kys on ur kybrd
|
|
|
|
|
That made me laugh out loud
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
That took me a minute to translate. I ran it through Babelfish, but there's no option for "Txt spking idiot to English" in there (and I'm not calling you an idiot here ).
modified on Thursday, September 18, 2008 7:14 AM
|
|
|
|
|
It still surprises me how easy English is to read if you drop most/all vowels. maybe these 1d10t txtspkrs have a point
|
|
|
|
|
Hello All,
i use checkboxlist & fill it by data source.my data item are more n all are load in that checklistbox n page becomes large.Tell me how i control it and Pls also send how i trap multiple checked items or value in that checklistbox
Amit Gautam
|
|
|
|
|
gautamamit8 wrote: Pls also send how i trap multiple checked items or value in that checklistbox
For each checkbox in checkboxlist
if (checked = true)
do something
gautamamit8 wrote: i use checkboxlist & fill it by data source.my data item are more n all are load in that checklistbox n page becomes large.Tell me how i control it
What do you mean? You want to limit the amount of checkboxes?
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
hi i my pro im using orcale client server
while i m using update query i run properly. but instead of query im using storeprocedure i can not execute it display error like 'invalid sql statement '
if im execute that procedure in my pl/sql it run properly
my code is like
public string exeQry(string qry)
{
int a;
if (Con.State == ConnectionState.Closed)
{
Con.Open();
}
cmd = new OracleCommand(qry, Con);
a = cmd.ExecuteOracleNonQuery();
Con.Close();
return Convert.ToString(a);
}
with regards,
bretto
|
|
|
|
|
Hi
I cann't set radiobuttonlist.item(0).selected = true in multiview control.
When i change the radiobuttonlist selected to item(1) in view 2 and back to view 1 and go to view 2 again .I cann't change selected to item 0.
.aspx page
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
asp:MultiView ID="MultiView1" runat="server">
<asp:view id="View1" runat="server" xmlns:asp="#unknown">
<asp:button id="Button1" runat="server" text="Button" />
</asp:view>
<asp:view id="View2" runat="server" xmlns:asp="#unknown">
<asp:button id="Button3" runat="server" text="Button" />
<asp:radiobuttonlist id="RadioButtonList1" runat="server">
<asp:listitem selected="True" value="0">x</asp:listitem>
<asp:listitem value="1">t</asp:listitem>
</asp:radiobuttonlist>
</asp:view>
</form>
</body>
</html>
code behind
Partial Class test
Inherits PageBase
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.RadioButtonList1.Items(0).Selected = True
Me.MultiView1.ActiveViewIndex = 1
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.MultiView1.ActiveViewIndex = 0
End Sub
End Class
please help me
modified on Thursday, September 18, 2008 5:07 AM
|
|
|
|
|
You need to close your RadioList with:
You also need to set the onclick for the button in the aspx code
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Thank for reply but i already closed tag radiobuttonlist.But i don't know why it's not show in web. Any one can help (sorry for my bad english)
|
|
|
|
|
Did you do the 2nd bit of my post? Add the onclick delcaration to the aspx control. Its currently not specified.
you have:
<asp:button id="Button1" runat="server" text="Button" xmlns:asp="#unknown">
you need
<asp:button id="Button1" runat="server" text="Button" onclick="Button1_Click" xmlns:asp="#unknown">
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Hello,
please check
1. http://www.golsinc.com/app7/demo1.aspx[^] (On IE)
and
2. http://www.golsinc.com/app7/[^] (On Firefox)
when you click on image on 2nd url i gave, it creats a Circle, Triangle and Square repectively. but i does not show the coordinate where the pointer is and at every click page posts to the server.
in 1 url, page doesnt posts back and has all the features i need besides Circle, Triangle and Square genaration on clicks. i made 1st url page with the help of javascript but 2nd is totally made on asp.net c#
Could anybody please help me in solving this problem for Url 1 ??
Reply soon
Thanx
Any Movie, Software, Song, Game and many more.... Only at Developer's Solution
http://www.devsol.co.nr
Search Any Torrent You Want
A Software for Torrent search only....
Must check it
...VAIBHAV SARAN
vikysaran@gmail.com
|
|
|
|
|
Dear All,
I am using C# , asp.net , ajax1.0
My requirement is I have to give alert message and redirect to another page based on some condition
Please suggest some link or idea
Please help
imran khan
|
|
|
|
|
You could use a javascript popup box and then have a yes or no condition in it. Depending on which the user chooses you can redirect them to a certain page.
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Use Javscript for that
Rigister a javscript function that will first show alert message then
redirect user to next page
Use javascript code to redirect
javascript:window.location.href='NextPageName.aspx'
Why you want to use Ajax for this ?
Is there any business logic for it ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
Hi all,
I have a requirement of exporting webpage as image into MS Word, PDF and Power Point.
I succeeded converting the Web Page into Image by using the WebBrowser control.
But i have to export these image to MS Word, PDF and Power Point.
Please suggest me, how to do that.
Thanks in advance,
Cheers'
sekhar
|
|
|
|
|
Check this project[^]
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
Hi again...
What i really need is to add a superscript trademark sign in title of one sitemapnode in a sitemap.
i tried to add "&_#_0174"(eliminate the underscore _ ) but it has an error, i think you can't add other html tag inside a <sitemapnode>?
I also tried to delete the tag but the trademark sign is not in superscript form.
can anyone help me?
Thank's a lot!
Ewin
|
|
|
|
|
DateTime dtToday = new DateTime();
dtToday = DateTime.Today; //in my system mm/dd/yyyy
DateTime dtSelectedDate = new DateTime();
dtSelectedDate = Convert.ToDateTime("09/18/2008"); //conver in date correctly
But in other system.....
DateTime dtToday = new DateTime();
dtToday = DateTime.Today; //in other system dd/mm/yyyy
DateTime dtSelectedDate = new DateTime();
dtSelectedDate = Convert.ToDateTime("09/18/2008"); //throwing exception
what to do? how i know that in system which formate is used so when i try to convert at that time i passed correct formate ?????
|
|
|
|
|
You can supply IFormatProvider instance to the method. Supply systems culture.
|
|
|
|
|
Hi , m working on a web application (Asp.net using c#) , in my master page there is some menus . by clicking them a pop up window open , but the problem is this when i minimize the first pop up window , and then open another pop up by clicking my menus nothing happend .
for open new pop up window first i have to close the previous window , then next one window open ,
Can is it possible that i open 2 - 3 pop up windows at the same time .
Thanx in adva nce
|
|
|
|