|
Your probably looking for the Shell function SHFormatDrive[^]. This will open up the standard Format dialog you get when you click on Format in a drives context menu in Explorer.
Private Declare Auto Function SHFormatDrive Lib "shell32.dll" ( _
ByVal hWnd As IntPtr, ByVal drive As Integer, _
ByVal fmtId As Integer, ByVal options As Integer ) As Integer
...
Dim retVal As Integer
retVal = SHFormatDrive( Me.Handle, 0, 0, 1 )
hWnd is the handle to the parent window of the dialog, usually the current form's handle.
drive is the 0-based drive number. 0 for A:, 1 for B:, 2 for C:, ...
fmtId is the format code. 0 for 1.44/1.2MB floppies, 3 for 360KB, 5 for 720KB.
options is the format type. 0 for a Quick Format, 1 for Full Format, and 2 to copy the system files to the floppy.
The options are filled into the dialog. You can't just format the disk without the user interface using this function.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I Want To Source Code For List All Hardware & Software In Your Computer
I Do Project About Support Computer But I Don't Know About Code For Find Hardware & Software In Computer Help Me Please
-- modified at 4:38 Wednesday 21st December, 2005
|
|
|
|
|
Can any one help me...
i want to copy one table from one database to another
Sasmi
|
|
|
|
|
You mean you want to write a tool to do this?
<< >>
|
|
|
|
|
Are you talking about MS SQL server? On MS SQL server the best and fastest way is to use import or export wizard from one database to another.
or if you have SQL expeirece just create script for table create and create it in destination and next use SQL query to copy data from source to destination. You can also create SQL statement which will automatically create table on insert for you. But I think that for you import/export Wizard is the best solution.
jpazgier
www.jpazgiersoftware.com
|
|
|
|
|
Hi!
Asuming that you are using MS SQL Server
You need to avoid primary key and null value violations on your own
Use
Insert Into [Source Database Name].[Object Owner Name].[Destination Table]
From
[Destination Database Name].[Object Owner Name].[Source Table Name]
Example:
Insert Into NorthwindBackup.dbo.Products
Select * from NorthWind.dbo.Products
Or
Insert Into NorthwindBackup..Products
Select [Fields List] from Northwind..Products --name, data type and sequence of the fields must be the same as in destination table
--you may include your WHERE clause here
|
|
|
|
|
Hey All,
In my application I have Print Feature
Now What I want that as the User Click on Button Print
I have shown Printer Dialog Box to Select the Printer
Now AS user selects the printer I want to know about the Selected printer
is a :
Laser Printer
Dot Matrix
Or Label Printer etc
After determining the printer I have perform a certain task
My Problem is How to determine the printer type (Laser etc.) after selection from the user????
Hope My Question is Clear
Wating for all early replies
Thanks in advance
Hema Chaudhry
|
|
|
|
|
The InstalledPrinters collection has an IsPlotter property; but, I don't think printer type other than plotter is readily available. If anyone knows better, I'd like the answer to this one also.
Do or not do. There is no try.
|
|
|
|
|
|
Thanks for the Precise answer,
But I have tried this earlier also; I gives an exception In the following line , I can;t understand why is this giving this type of exception (System.NullReference)
Dim intMarking As Integer = CType(mo("MarkingTechnology").ToString
can U get the problem
If Yes Plaz resolve this
Thanks a lot
Hema Chaudhry
|
|
|
|
|
I am connecting to a database. now i trying to get the information about database like Backup info, database size, Owner, Creation date etc.
How can i get this information? Any help will be appreciated.
|
|
|
|
|
I work with SQL Server, so I don't know if this helps with other DBMS's, but have you tried looking in the Master database, system tables? There is a wealth of information about the databases in there.
Roy.
|
|
|
|
|
I have a very simple xml file
<RegistrationSettings>
<SMTPServer>mail.not-real.com.au</SMTPServer>
<FromAddress>from@not-real.com.au</FromAddress>
<HostName>Jason</HostName>
<HostAddress>jason@not-real.com.au</HostAddress>
</RegistrationSettings>
and I want to read a single value out of that, for example: <HostName>
I don't know how to do this
This is the code I have at the moment (inItemName = "HostName")
Try
xmlobjReader = New XmlTextReader(_XMLPath)
xmlobjReader.WhitespaceHandling = WhitespaceHandling.None
While xmlobjReader.Read
If xmlobjReader.Name.ToLower = inItemName.ToLower Then
itemValue = xmlobjReader.Value
End If
End While
Catch ex As Exception
itemValue = ""
Finally
If Not xmlobjReader Is Nothing Then
xmlobjReader.Close()
End If
End Try
At the end of this code itemValue == ""
I know this should be easy, but I can't see what I am doing wrong.
Thanks for any help
/jason
|
|
|
|
|
Jason,
The parsing of the XML was not quite correct. Try this amended code.
Try
xmlobjReader = New XmlTextReader(_XMLPath)
xmlobjReader.WhitespaceHandling = WhitespaceHandling.None
xmlobjReader.MoveToContent()
Dim isHostName As Boolean
Do While xmlobjReader.Read
Select Case xmlobjReader.NodeType
Case XmlNodeType.Element
isHostName = (rdrXML.Name.ToUpper = "HOSTNAME")
Case (XmlNodeType.Text And isHostName)
itemValue = xmlobjReader.Value
End Select
Loop
Catch ex As Exception
itemValue = ""
Finally
If Not xmlobjReader Is Nothing Then
xmlobjReader.Close()
End If
End Try
Step through the code in the debugger and inspect the various variables to see what's happening.
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
Thanks for your help Steve, but in the end I decided not to go that way. I decided it was too slow to loop throw each element in the XML and check it's type etc
instead I have used a dataset
Public Sub New(ByVal inXMLFilePath As String)
_XMLPath = inXMLFilePath
_dsRegistrationValues = New DataSet(_DATASET_TABLE_NAME)
_dsRegistrationValues.ReadXml(_XMLPath)
End Sub
<br><br>
Public Function ReadItem(ByVal inItemName As String) As String
Dim returnSettingValue As String
returnSettingValue = _dsRegistrationValues.Tables(0).Rows(0).Item(inItemName)
Return returnSettingValue
End Function
I got the idea from this article, if you are interested
http://www.codeproject.com/vb/net/ConfigOpt.asp[^]
/jason
|
|
|
|
|
That's a neat solution Jason. Thanks for the link. I'll check it out.
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
How can you import 2003 VB.net codes or application into VB.net 2005?
Dmaster
|
|
|
|
|
Visual Studio 2005 includes a VS 2003 conversion tool. It will automatically update the VS 2003 project to VS 2005 when you open it.
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
|
Hello everybody. I have a weird error message coming up every time i try to use the Update command with a access database. The message says that there is a syntax error with the SQL command. I search the Internet and the syntax of my command seems to be right.
Here is the code:
============================================================================
Public Sub updateRecord(ByVal entryToChange As String, ByVal oldString As String, ByVal newString As String)
Dim SQLString As String
Dim strConnection As String = OleDbConnection1.ConnectionString
Dim objTransaction As OleDbTransaction
Dim connect As New OleDbConnection(strConnection)
SQLString = "UPDATE tblIns SET " & entryToChange & " = '" & newString & "' WHERE Ins = '" & oldString & "'"
Dim cmd As New OleDbCommand(SQLString, connect)
connect.Open()
Try
cmd.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
connect.Close()
connect.Dispose()
Me.Close()
End Sub
============================================================================
I have a value that changes (newString) and a value that i know it's the same (oldString). entryToChange is the entry that i'm trying to change (eg Date, or FirstName etc) So basicly i'm trying to change a value of a record where the oldString stays the same. But i get the error "Syntax error with UPDATE command". What is going on?
And is there a way to update a record when the entry that is changing is not the same all the time? Meaning in one record the first name may change and all other entries (eg last name, address etc) stays the same, in the other the last name may change and the rest of the entries will stay the same. In VB6 i used to use something like:
==============================================================
DatIns.Recordset.Edit
DatIns.Recordset.Fields("Date").Value = lbldate.Caption
==============================================================
but in vb.NET i can't find something like this. Thank you for your help, and Merry Christmas to all.
Still trying to find the way
-- modified at 18:27 Tuesday 20th December, 2005
|
|
|
|
|
What is the value of SQLString when cmd.ExecuteNonQuery() executes?
-- modified at 8:41 Wednesday 21st December, 2005
|
|
|
|
|
The SQLString ends up looking like this:
SQLString = "UPDATE tblIns SET Date= '21/12/05' WHERE Job_Number = '0909090'
which looks like it's correct. But i still get an error message of "Syntax error". What am i doing wrong?
Still trying to find the way
|
|
|
|
|
Have you tried this? Assuming tblIns.date is a date field.
"UPDATE tblIns SET Date= cdate('21/12/05') WHERE Job_Number = '0909090'
|
|
|
|
|
I have the following code in a C++ shell extension from a user selecting files right click. I have the list of files and can iterate them through a progress dialog, but how do I send them to and receive them in a list box VB forms application? THanks.
HRESULT CDllRegShlExt::InvokeCommand ( LPCMINVOKECOMMANDINFO pCmdInfo )
{
// If lpVerb really points to a string, ignore this function call and bail out.
if ( 0 != HIWORD( pInfo->lpVerb ))
return E_INVALIDARG;
// Check that lpVerb is one of our commands (0 or 1)
switch ( LOWORD( pInfo->lpVerb ))
{
case 0:
case 1:
{
CProgressDlg dlg ( &m_lsFiles, pInfo );
dlg.DoModal();
return S_OK;
}
break;
default:
return E_INVALIDARG;
break;
}
}
|
|
|
|
|
Is this accomplished through the clipboard?
|
|
|
|