|
|
Hello
I'm trying to do an auto uploader for my own usage, as I have a lot of files to upload.
I took a new form, put an hidden WebBrowser and made a "login" function. Okay, all of this is working nicely but I cannot find how to fill the form for uploading.
If you want the page : http://www.uploadjockey.com.
Can somebody please help me ?
Thanks in advance for your answers
|
|
|
|
|
hi there,
i asked a question earlier to try and get information from command prompt howver i seem to have found a better way.
here is the code used
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Management
Namespace VBDotNet_WMI_HD_GetSerialNumber_2
Public Class MainForm
Inherits System.Windows.Forms.Form
Private button1 As System.Windows.Forms.Button
Public Shared Sub Main()
Dim fMainForm As New MainForm
fMainForm.ShowDialog()
End Sub
Public Sub New()
MyBase.New()
Me.InitializeComponent()
End Sub
#Region " Windows Forms Designer generated code "
Private Sub InitializeComponent()
Me.button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'button1
'
Me.button1.Location = New System.Drawing.Point(8, 8)
Me.button1.Name = "button1"
Me.button1.Size = New System.Drawing.Size(280, 32)
Me.button1.TabIndex = 0
Me.button1.Text = "&Get serial number"
AddHandler Me.button1.Click, AddressOf Me.Button1Click
'
'MainForm
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 45)
Me.Controls.Add(Me.button1)
Me.Name = "MainForm"
Me.Text = "Testform <WMI - Harddisk - Get Serial Number. 2>"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim Result As String = GetHarddiskSerialNumber("c:\")
If (Not Result Is String.Empty) Then
MessageBox.Show(Result, "Info")
End If
End Sub
Private Function GetHarddiskSerialNumber(ByVal drv As String) As String
Try
Dim BackSlash As String = "\"
Dim Position As Integer = drv.LastIndexOf(BackSlash)
If Position > -1 Then
drv = drv.Substring(0, drv.Length - 1)
Else
drv = drv
End If
Dim mo As New _
ManagementObject("Win32_LogicalDisk.DeviceID=""" & drv & """")
Dim pd As PropertyData = mo.Properties("VolumeSerialNumber")
Return pd.Value.ToString()
Catch ex As Exception
MessageBox.Show(ex.Message, "Info")
End Try
Return String.Empty
End Function
End Class
End Namespace
however this code is for vb6, and there are a few errors in it.
all i want the code for is to show a serial number up.
here is the link that may help
http://www.visual-basic5.de/vbclassic/dotnet/serialnumberfromhd.htm[^]
i don't really know much about WMI so that is why i am trying to pst as much info as i can
cheers
|
|
|
|
|
offroaderdan wrote: however this code is for vb6
i somehow don't think the code you listed is from vb6......do you mean that the code has been ported from vb6 original code and may contain some errors.
|
|
|
|
|
umm yeh it contains some errors.
|
|
|
|
|
and i ain't very good at solving them if im being perfectly honest.
I literally copied and pasted the code into a new form hoever when tryingto run the code this don't work
I really need this code so if anybody could help resolve this that would be great
|
|
|
|
|
Do you have the vb6 code?
|
|
|
|
|
no i thought it was orignally written in vb6 however it aint
i copied and pasted the code into vb.net however when trying to run it this doesn't work?
|
|
|
|
|
See my reply to your other post. There's a link to an example of executing a WMI query in there.
|
|
|
|
|
Thanks for the reply, this has now rely confused me. What would do i simply do something along the lines off
Dim instance As ManagementObjectSearcher
Dim returnValue As ManagementObjectCollection
returnValue = instance.Get()
and then something like
SELECT SerialNumber FROM Win32_BIOS"
??
i have never really tried anything like this before so its all new to me
|
|
|
|
|
i have tried using the code you said but got this far, how do i fix it?
Imports System
Imports System.Management
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
End Function 'Main
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As New ManagementObjectSearcher( _
select SerialNumber from Win32_BIOS"" ' the bit of code you told me to put in it!!
New EnumerationOptions( _
Nothing, System.TimeSpan.MaxValue, 1, _
True, False, True, True, False, _
True, True))
For Each service As ManagementObject In s.Get()
'show the instance
TextBox1.Text = (service.ToString())
Next
End Sub
End Class
thanks Dave for the help!!
|
|
|
|
|
something like this
Public Sub q()
Dim s As New ManagementObjectSearcher( _
"root\MyApp", _
"SELECT SerialNumber FROM Win32_BIOS", _
New EnumerationOptions( _
Nothing, System.TimeSpan.MaxValue, 1, _
True, False, True, True, False, _
True, True))
For Each service As ManagementObject In s.Get()
'show the instance
TextBox1.Text = (service.ToString())
Next
End Sub
|
|
|
|
|
Here,
Create a new winforms project;
Add a reference to System.Management
Add 2 List boxes to your form and a button with name to match the code below and Run it.
Imports System.Management
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Enumarate Drives List
For Each drive As System.IO.DriveInfo In System.IO.DriveInfo.GetDrives
ListBox1.Items.Add(drive.Name)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ListBox1.SelectedItems.Count > 0 Then
ListBox2.Items.Clear()
'Get the WMI Properties for the Drive and populate the list box
Dim query As New SelectQuery("Win32_LogicalDisk")
'ManagementObjectSearcher retrieves a collection of WMI objects based on the query.
Dim search As New ManagementObjectSearcher(query)
' Display each entry for Win32_LogicalDisk
Dim info As ManagementObject
For Each info In search.Get()
For Each item As PropertyData In info.Properties
ListBox2.Items.Add(item.Name & " : " & item.Value)
Next
Next
End If
End Sub
End Class
modified on Wednesday, October 28, 2009 1:10 PM
|
|
|
|
|
works like a treat!
However is there any way that i can get drive "C" to appear and in a textbox and have volume serial number of the drive in a txtbox.
so it would look something like this
text box 1 contents = volume serial "blah blah blah"( number) of "C"
I have never really played around with list boxes, i only really know txt boxes and labels!!
Many thanks Dave!
|
|
|
|
|
Thats just basic string manipulation. If you can't work that out you shouldn't be trying to mess about with WMI!
Also if you look at the documentation for the classes used, you will see it is also possible to query just the single property you want, rather than have to iterate each one.
Go try and figure it out, and then come back with what you tried if you have problems.
I am not going to do it all for you!
|
|
|
|
|
ok i had ago with the changing the code around
this is how far i got t cant seem to figure it out all i need is if drive "c" contains a volume serial number then that is placed on a text box
i had a go at changing
For Each drive As System.IO.DriveInfo In System.IO.DriveInfo.GetDrives
ListBox1.Items.Add(drive.Name)
Next
to Dim drive as system.io.driveInfo
listbox1.items.add("C:/")
this seemed to work however in list box 2 it still displayed 4 drives??
i tried to extract certain bits of data from lit box to textbox, however this didn't work.
If ListBox2.Items.Contains("VolumeSerialNumber" & " : " & item.value) Then
TextBox1.Text = "VolumeSerialNumber" & " : " & item.value
End If
Is there any way that with each drive a list box can be dedicated to that drive rather than having a massive list?
Many thanks
|
|
|
|
|
|
definitly not ... imports ... not in vb6
|
|
|
|
|
Hello Everybody
I have create an outlook plug-in which is use to send the new mail from inbox to other user. when i send mail from my company mail account to outlook then outlook again send the mail to particular user then it is adding HYPERLINK mailto:dc@isol.co.in automatically. i only want to send original message and don't want to add extra word.
Let me explain with example:
I send mail from my company E-mail ID and mail body contains following information "Send all query at dc@isol.co.in"
When i click on outlook send/receive button i received same message as above.
but using plug-in when i forward this outlook mail to other user then he is getting following message
"Send all query at HYPERLINK mailto:dc@isol.co.in dc@isol.co.in"
in above message HYPERLINK mailto:dc@isol.co.in is extra word. i want to remove this.
how can i handle this, please give me advice.
I am using vb.net 2005 and outlook 2007
Thanks
Dharmchand Dhingra
|
|
|
|
|
Hi there,
Is there any way that i can use command prompt to get info that is needed for my program,
I am currently doing a project on security and we have got to "try" and make a program that will make it harder for another person to use the program.
I have found out that using command prompt and typing in "wmic bios get serialnumber"
this then displays a serial number
i would like to incorporate this number displayed in the command prompt into the program as this will be saved on a .txt file
any ideas would be very helpful
i am a bit of a noob programmer so sorry if being a bit thick
i am using vb.net
cheers
|
|
|
|
|
That is just a WMI query returning the manufacturer supplied serial number from an instance of the WMI "Win32_BIOS" class, from the WMI Namespace "root\CIMV2".
The WQL string would look like this:
SELECT SerialNumber FROM Win32_BIOS"
You can find an example of returning an object from WMI here[^].
Please keep in mind that there is nothing that says each manufacturer has to supply that information in WMI. You might get nothing back.
modified on Wednesday, October 28, 2009 10:27 AM
|
|
|
|
|
I am allowing a user to input values into a text box click a button and then display and calculate the standard deviation of the values enterd, but the code i came up with does not seem to be working correctly, and i cant figure out why or what is wrong????? I need to get each value entered by the user, then subtract each value by the Mean/avg and store the answer in a variable(dDev), then i need to sqaure each value, after that then i need to add each value i have come up with and then add the squared values together for a TOTAL
Str = txtGrades.Text 'store string into variable
strArr = str.Split(" ") 'use split to seperate words by space
For count = 0 To strArr.Length - 1
'add user entered values to list box
lstGrades.Items.Add(strArr(count))
lblGrades.Text = lstGrades.Items.Count
iSum += Convert.ToDouble(strArr(count)) 'get sum of values entered and pass to storing variable
lblSum.Text = iSum 'display sum in label box
*********************************************************************
dDev = ((strArr(count) - (dFAvg)) ^ 2)
dSqDev += dDev
*********************************************************************
dTotalDev = (dSqDev / strArr.Length - 1)
Next 'end for
dFAvg = Convert.ToDouble(lblSum.Text) / Convert.ToDouble(lblGrades.Text) 'calculate average
lblAvg.Text = FormatNumber(dFAvg, 2) 'display average after storing calculation in variable, format to display only 2 decimal places
lblSumDev.Text = FormatNumber(dSqDev, 2)
|
|
|
|
|
You appear to me to be a little dense. The last time you asked this, it was pointed out that iSum is never initialised. I still don't see code to do that, and that would certainly break your result.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Dim iSum As Integer = 0
Dim dFAvg As Double = 0
Dim dDev As Double = 0
Dim dSqDev As Double = 0
i have these being declared before my subroutine
then this is my subroutine for my array using a for loop to load all values into teh list
but the part that dont know if i am dng correctly is my dDev= ((strArr(count) - dFavg) ^2) it keeps giving me the wrong answer
For count = 0 To strArr.Length - 1
'add user entered values to list box
lstGrades.Items.Add(strArr(count))
lblGrades.Text = lstGrades.Items.Count
iSum += Convert.ToDouble(strArr(count)) 'get sum of values entered and pass to storing variable
lblSum.Text = iSum 'display sum in label box
'***********************
dFAvg = iSum / Convert.ToDouble(lblGrades.Text) 'calculate average
'***********************
dDev = ((strArr(count) - dFAvg) ^ 2)
dSqDev += dDev
Next 'end for
|
|
|
|
|
PAguilar09 wrote: i have these being declared before my subroutine
This means your code will only work once.
PAguilar09 wrote: iSum += Convert.ToDouble(strArr(count))
iSum is an integer, why are you converting to double ?
PAguilar09 wrote: dFAvg = iSum / Convert.ToDouble(lblGrades.Text)
How does this calculate an average when it's done on each iteration ? Why not just use lstGrades.Items.Count instead of converting the string ?
Either way, it seems wrong to me. Each time around, the total so far gets divided by the total number of items ( not the number of items added so far ). Then you take this value, which is not an average of anything, and you subtract it from the last added value. Then you square that number. Then you add this to the cumulative total. I don't understand how that gives you any sort of meaningful result.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|