|
Is that related to that virus GoogleNoWorkyOnMyComputer.win32
|
|
|
|
|
|
So the googleNoWorky virus is coded in classic VB? That explains a lot.
|
|
|
|
|
I am trying to get the standard deviation of values that a user enters into a textbox and then will hit a display button, the following is what i have coded so far but For some reason i am getting the wrong answers for stdeviation and the sum of deviations PLEASE HELP
Dim iSum as integer = 0
Dim dFAvg as double = 0
Dim dDev as double = 0
dim dSqDev as double = 0
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
'***********************
'THIS IS WHAT IS NOT CALCULATING CORRECTLY!!!!!!
dDev = ((strArr(count) - dFAvg) ^ 2)
'for each value the user enters it is supposed to be subtracted by the MEAN(dFAvg) and then raised by 2
'then i store each answer into dDev VARIABLE and then find the sum of all the values in dDev and assign it to dSqDev
'but i dont understand what i am doing wrong PLEASE HELP
dSqDev += dDev
Next 'end for
lblSumDev.Text = FormatNumber(dSqDev, 2)
|
|
|
|
|
This at least the third time I have seen you asking the same question. In all of them your code is unformatted and uncoloured. It is therefore very difficult to read, which cuts down on the number of people willing to try to plough through it in order to attempt to help you.
Edit your post (above), put a <pre> tag on the line above your code and a </pre> tag on the line after your code. Then put back the indentation so that people at least have a chance to read and understand it.
Have you tried Googling for this?
I googled on vb.net calculate standard deviation and I got loads of hits with fully working code examples. Why not try that yourself?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
thanks i got it working on my own, i saw what was wrong
and i will remember to post code correctly
next time.
thanks for your help and time
|
|
|
|
|
Good stuff!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry is right, your code needs proper formatting.
Use PRE tags and you will probably be able to see what is wrong yourself.
Hint: your calculations are completely wrong.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Luc,
Thank you for your support. I shall wear it always!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
You're welcome.
And don't you worry, there is a great deal of wear in it.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
You keep posting the same crappy code. I ask again, how is dividing the cumulative sum against the number of items what you want ? If you won't fix the most basic of poor decisions based on advice I've given you, then it seems like what you really want is for someone to do your homework for you. I suggest instead that you contact your teacher and tell them you are too dumb for their course.
OR you could try to actually learn programming. Break the task down into steps. Work it out on paper so your steps lead to the right answer. Step through in the debugger and work out at what point your code is not doing what you expect it to.
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.
|
|
|
|
|
Christian Graus wrote: Break the task down into steps. Work it out on paper so your steps lead to the right answer. Step through in the debugger and work out at what point your code is not doing what you expect it to.
Excellent point.
Christian Graus wrote: suggest instead that you contact your teacher and tell them you are too dumb for their course.
Another excellent point
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
i got it to work on my own, didnt need ur help but thanks and God bless
hope that you dnt treat all users the way you
disrespected me.
|
|
|
|
|
Reformat your code so it is easier to read (use
code block tag) that aside, relook through the steps you are taking to solve the problem. You do have calculation mistakes and leaving it as an exercise for you to find.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
thanks i will do that next time i place code on the forums.
i got it to work anyways but thanks!
|
|
|
|
|
You are getting the incorrect result because you are trying to get the mean as a running total, and dividing only part of true mean, here is what i mean:
dFAvg = iSum / Convert.ToDouble(lblGrades.Text) 'calculate average
but the way you are calling it in the loop the first time you calculate the mean you are using only one number, then performing your deviation with that. The next loop you have the mean of 2 numbers and use that for your calculations. So what you want to do is load everything and calculate the mean, then use that to loop through and plug into your calculations. The below works:
Dim iSum As Integer = 0
Dim dFAvg As Double = 0
Dim dDev As Double = 0
Dim dSqDev As Double = 0
Dim strArr As Array = {1, 3, 4, 6, 9, 19}
For count = 0 To strArr.Length - 1
iSum += Convert.ToDouble(strArr(count))
lstGrades.Items.Add(strArr(count))
lblGrades.Text = lstGrades.Items.Count
lblSum.Text = iSum 'display sum in label box
dFAvg = iSum / Convert.ToDouble(lblGrades.Text) 'calculate average
Next
For count = 0 To strArr.Length - 1
dDev = ((strArr(count) - dFAvg) ^ 2)
dSqDev += dDev
Next 'end for
lblSumDev.Text = FormatNumber(dSqDev, 2)
End Sub
|
|
|
|
|
Hello,
Does anyone have a code example for vb.net 2008 to locate an email on a windows mobile device (checking the subject) and then read the body of it?
I can find examples in C but not VB. Any help would be great.
Thanks
|
|
|
|
|
|
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?
|
|
|
|