I am currently working on a program to graph a histogram of the Dow Jones, the following is my code
CODE:
Im not sure if my getdata() sub routine is correct. I want this to display a histogram of returns for the DJIA as well as display the mean and standard deviation.
Also, on my Convert(Y) function it keeps saying im diviging by zero but I dont see how I am.
I've plot a histogram in a picturebox called picHisto, but i'm having a problem in save it to jpeg or other format. When it saved, it appears to be a blank or white picture. The code below is the code i used for saving, thanks for the help.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim img As New Bitmap(picHisto.Width, picHisto.Height) Dim g As Graphics = Graphics.FromImage(img)
I am using Visual Studio 2005 and .NET 2.0 to display data pulled from a Oracle table. I am trying to display a notes column, but the column is not displaying the CRLF characters properly. The text is showing as a single line.
Private Sub BindNotesGrid() Dim colRequestNotes As New BoundColumn() Dim colCreatedBy As New BoundColumn() Dim colCreatedDate As New BoundColumn()
Dim assSummary = From a In db.Assignments Join ur In db.UserRegions On a.Origin.ID Equals ur.Region.ID
[code]....
In the controller I can return the data easily as follows:
For Each c In assSummary MsgBox(c.Description & " " & c.AssCount) Next
If I pass the object through to the view using Viewdata("assSummary") = assSummary, how do I display the data? Every method I've tried results in messages about 'VB$AnonymousType_7(Of Integer,String) and I don't know how to retrieve the data from the anonymous type.
I have some code which gets child items for a menu via the GetChildren function which takes a list of menuData: Dim builtMenu As New List(Of MenuData)(_rawData.FindAll(Function(item) item.GroupingID = 0))
For Each menuData As MenuData In builtMenu If menuData.Children IsNot Nothing Then menuData.Children.AddRange(GetChildren(menuData)) End If Next
If I check if menudata.children isnot nothing, it always is nothing because the GetChildren function is yet to run (providing the child items, which do exist). If I remove this check and just have this code:
Dim builtMenu As New List(Of MenuData)(_rawData.FindAll(Function(item) item.GroupingID = 0))
For Each menuData As MenuData In builtMenu menuData.Children.AddRange(GetChildren(menuData)) Next
Then I am presented with a Object reference not set to an instance of an object error on menuData.Children.AddRange(GetChildren(menuData))
i have a datatable with column "prices" and i displeay the column values in a listbox and i sum all the values in this column and i display the sum in a label.text but when i delete one row in de listbox the sum returns a zero value.[code]
I am using Sql Server 2005 and Vb Studios 2010 on a .net Framework of 4.0. I am trying to get the exact number of rows from a database and populate a datatable then have a label show the number of rows.
Dim comm2 = db.selectcommand(db.conn, "*", "Tablename", " columnname = '" & Session(sessionvariable) & "' AND columnname = 'Unread '") Dim sqlda2 As New SqlDataAdapter(comm2)
I've got my text files read into an array.Which was step 1 .My code so far is:
Note: textSKU is just a text box. No event handler associated.
Private Sub BtnSeacrch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSeacrch.Click Dim objCA As New System.IO.StreamReader(ofdCA.FileName) System.IO.StreamReader(ofdWarehouse.FileName)[code]....
The message box is mostly just to test to see if it's finding the line. And the problem is it's returning -136.Which I'm pretty sure can't be a value in the array ( actually very sure, as I tested it just to be sure, and it says it's out of bounds).I know it's in the array, as when I change returnvalueCA to a...7 for example, it outputs the correct line from the .csv file.
Edit: Index was outside the bounds of the array. is what the debugger says, as it's trying to output the value of SKUSheet(-136)
I have to cut down the amount of code in my blackjack program so im trying to use a function however the function always returns a value of 0 I have tried putting in "return cardvalue" but it still comes out as 0 I dont know where I went wrong or if the code im using can even be used as a function.
Function Values(ByVal deal() As Integer, ByVal counter As Integer, ByVal cardvalue As Integer) As Integer If deal(counter) = 1 Or deal(counter) = 2 Or deal(counter) = 3 Or deal(counter) = 4 Then
as a workaround for the Locale bug in Office Interop I wanted to use VSTO but if I call
app.ActiveWorkbook.GetVstoObject()
then it returns nothing. I'm working from a .NET 2.0 Visual Basic Application project. This is not an add in or a special VSTO project. I have added the required Imports and References.
Dim app As New Excel.Application app.Caption = "Rapport" app.Visible = True app.Workbooks.Add() Dim tmp As Object = app.ActiveWorkbook.VBProject Dim book As Workbook = app.ActiveWorkbook.GetVstoObject() 'Returns Nothing
This is a school project and it needs to be finished by the end of next week
have a look at this code Dim colors() As KnownColor = CType(System.Enum.GetValues(GetType(KnownColor)), KnownColor()) Since CType is a function that returns DataType ,But here as in the code it seems that CType() is returning array having values that is assigned to color() array. How this is happening?
I've been having a problem with Math.Log in a function I'm trying to write. When working with variables, it always returns 0. Here's the line I'm trying to run:
Recently (I have no idea when) App.Path in VB6 started to return a URI rather than an absolute path for the location. Instead of returning something like "C:program filesmyapplication it has begun returning "\sacoc$program filesmyapplication"Has anyone else noticed this?
It breaks a whole crap-load of my code.It seems like MS, in their infinite wisdom, have decided there is some security breach with the way it was returned before - just guessing.
I want to get the row count of my datagridview. I currently use this code below. But the RowCount value is &H7. I have 7 rows displayed in the datagridview. The code below seems to work, but I don't understand what &H7 means. Does it have something to do with Hexadecimals?
' tell user if no results are available to update If dgv.RowCount < 1 Then MsgBox("There are no results available to set Ready.", MsgBoxStyle.Information) Return "Failed"
This returns "ţ" when it should be "þ" However, Asc("ţ") returns 116. This: Asc(Chr(254)) returns 116.Why would Asc() and Chr() be different?I checked and the 'wide' functions do work correctly: ascw(chrw(254)) = 254
On the publish tab of My Project the correct current version is there, 1.1.0.0 and in Programs and Features under Control Panel it shows 1.1.0.0 but when I reference Application.ProductVersion I get 1.0.0.0.
Im trying to make a web service in VB.net is their a way that i can return the results that i get from LINQ. ie "return objreturnLINQResults" I have tryed to set my Public Function GetAlarmsByGUIS(ByVal DeptGUID As String, ByVal IdNumber As String) As Linq.DataContext . i just keep getting errors.
Public Function GetAlarmsByGUIS(ByVal DeptGUID As String, ByVal IdNumber As String) As Linq.DataContext Dim lqAlarms As New linqAlarmDumpDataContext
I have a WPF application that uses a third-party library to perform a specific task; this library, in one of its methods, executes the statement Assembly.GetEntryAssembly(). If I run the WPF application on debug (by running a .Net exe for testing) the library works properly and Assembly.GetEntryAssembly() returns a reference to the assembly of the executable, but in production I have a different situation that causes me some problems.
One of our technicians asked my to write a small library file in which he would pass a filename and an integer. The library would load the text file and find the integer in the text file referenced by the file name and return a string back to his program. He is working in a third party application that uses VB as its scripting language.So, not wanting to worry about the .net install on some of the older machines that he has his equipment installed on I decided to take a crack at C++ (VS 2010). I am doing applications development in C# and the last time I compiled any C++ code was in VS 6, but I though how hard can it be? Well I am typing here so things have taken a decidedly wrong turn. I started out with the C++ Side.
I wrote a vb program that would prompt the user to enter a number and then enter the exponent value they wanted the number raised to. When they clicked button 3 it did the calculation. everything worked perfectly.
Now I need to change the program. I must create a function in a module and then call that function from button3 click event. I have tried several different ways and even though it seems to "work", it keeps returning an incorrect value![code]...
I am trying to create an application for a wire company that sells spools of wire for $100 each. The normal delivery charge is $10 per spool. Rush delivery costs $15 per spool. The user should enter the number of spools ordered in a text box, and check Rush Delivery box if rush delivery is desired. When the Calculate Total button is clicked, an input box should appear asking the user to enter the number of spools currently in stock. If the user has ordered more spools than are in stock, a portion of the order is back-ordered. For example, if the user orders 200 spools and there are only 150 spools in stock, then 150 spools are ready to ship and 50 spools are back-ordered.
Attached is the code with comments on what each function is supposed to do. I dont know why but the form always returns zero.
'Declare variables
Public intNumberofSpools As Integer Public intBackOrder As Integer
In the following block of code always returns zero for the CPU usage. However, if I run it through Visual Studio in debugging mode, do a "Quick watch" on the variable "pcCPUCounter", add ".NextValue()" at the top, and tell it to reevaluate, that returns the varying percentage (eg, 5%, 71%, 16%, etc etc) as the processor utilization fluctuates.
Why would the code always print out zero, but the quick watch doesn't?
Private Sub UpdateCPUUsage(ByVal strSelectedServer As String) 'Performance items come Performance Monitor: perfmon.msc. 'The right-click on columns at bottom and select "add counter" to see list.
I have the following code in my application. When it is executed it brings out a null value at times, where i am sure there should be a value returned. I have checked by running the sql statement in the database and it returns the correct value. What could be wrong with my code? [Code]
Code: Private Sub DetermineTicketNumber() Dim objConnection As SqlConnection = New SqlConnection(strConnectionString) Dim objDataAdapter As New SqlDataAdapter
[code]....
My question is, how do I access the value that MAX() is returning from my SQL query?
I just started using macros two days ago in excel, programming them by hand in VB (i've never really used VB before this). In one of my macros I need to make an array of all the files and folders with a specific path, so i used a variation of the following code:
Of course there is more to my specific code but this is where the problem occurs (I've tested the return value with MsgBox and i still had the same problem) What should happen is that the first line would assign Thedir with a String representing the name of the first file/folder in the path. The second line would then assign a string representing the second file/folder in the path that the first Dir was called in. What instead happens is the first line sets Thedir = "." and then the second sets Thedir = "..". any successive call of Dir(, vbDirectory) will return the remaining files and folders in the path.