Dir With VbDirectory Returns Periods

Jan 8, 2010

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:

Thedir = Dir(some_path, vbDirectory)
Thedir = Dir(, vbDirectory)

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.

[Code]...

View 2 Replies


ADVERTISEMENT

How To Compare And Sum Values Of Multiple Periods Using LINQ

Sep 23, 2011

I have the following example datatable:[code]And now the user should be able to compare multiple periods. In this example the user chose two periods: 1.1.2010 - 31.12.2010 and 1.1.2011 - 31.12.2011. The result of the example should be:[code]

View 2 Replies

XML With Periods In Element Names Throws ArgumentException Error

Sep 6, 2011

I have an XML file where some of the elements have periods in their names. Using the code below, I receive the error:

"System.ArgumentException: Child list for field Stock cannot be created"It successfully reads the file if the periods are removed( i.e. StockAdjustment instead of Stock.Adjustment)

Dim myXMLfile As String = "C:file.xml"
Dim ds As New DataSet()
Dim fsReadXml As New System.IO.FileStream(myXMLfile, System.IO.FileMode.Open)
Try

[code]....

Is there a way to handle elements with periods in their names?

View 4 Replies

Object, (like A Circle On Screen), To Get Larger And Smaller Over Preset Periods Of Time?

Feb 7, 2011

I am looking for assistance writing code, (VB 05), that would cause an object, (like a circle on screen), to get larger and smaller over preset periods of time, (about ten second increments).

View 6 Replies

Null Check Always Returns Null, If Removed Returns Object Reference Not Set To An Instance Of An Object

Jun 24, 2010

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))

View 1 Replies

Sum Returns A Zero Value

Nov 16, 2010

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]

View 2 Replies

.net - IndexOf Returns Always Zero?

Sep 11, 2010

Could someone point me why the IndexOf returns always zero in the following text?

Dim Str as string = "<p><img class=floatLeft width="330"src="http://www.com"></p><p>"
Dim Idx as integer = Str.IndexOf("<p>")

Is there any other way, of getting the index?

View 1 Replies

.net - JSON.Net Always Returns {}

May 17, 2011

[Code]...

I always get {} as answer. What's wrong?

View 1 Replies

.NET Function That Returns PDF?

May 9, 2011

I'm trying to create a function that would return a PDF document. Something like this:

Function GetPDF(ByVal DirectoryPath as String) as PDF
Return DirectoryPath
End Function

View 1 Replies

Asp.net - Getting Row Count Only Returns Value Of 1

Apr 12, 2011

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)

[Code]....

View 4 Replies

Binarysearch Returns -136?

Oct 28, 2009

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)

View 5 Replies

Function Always Returns A Value Of 0?

Mar 25, 2011

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

[Code]....

View 4 Replies

GetVSTOObject Returns Nothing?

Jan 5, 2010

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

View 1 Replies

How To CType() Returns Value

Jul 7, 2010

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?

View 3 Replies

Math.log Always Returns 0?

Jul 29, 2011

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:

Quote:

mb = txtMb.Text
k = txtK.Text
t = txtT.Text

[Code].....

View 5 Replies

Vb6 App.Path Returns Only URI Now?

Mar 31, 2009

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.

View 2 Replies

Why Does Dgv.RowCount Returns &H7

Jul 25, 2011

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"

[code]....

View 1 Replies

.net - Asc(Chr(254)) Returns 116 In .Net 1.1 When Language Is Hungarian?

Oct 5, 2009

I set the culture to Hungarian language, and Chr() seems to be broken.

System.Threading.Thread.CurrentThread.CurrentCulture = "hu-US"
System.Threading.Thread.CurrentThread.CurrentUICulture = "hu-US"
Chr(254)

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

View 3 Replies

Application.ProductVersion Always Returns 1.0.0.0?

Oct 25, 2010

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.

View 2 Replies

Asp.net - Web Server Linq To Sql Returns?

Jul 31, 2011

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

[Code].....

View 1 Replies

C# - GetEntryAssembly Returns Null?

Apr 13, 2012

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.

[Code]....

View 1 Replies

C# Report Returns #error?

Feb 15, 2012

I get #Error in reportviewer when I use the following expression:

=IIf(Fields!PaymentNumber.Value>0,
IPmt(Fields!Annual_Interest_Rate.Value/1200,
Fields!Payment.Value,
Fields!No_of_Monthly_Payments.Value,
Fields!Total_Amount_Financed.Value),0)

When I remove the IPmt() function and use some static value instead, it works. Is there a way to find out the exact error ?

View 3 Replies

C++ DLL Returns Only First Character To An Application?

May 2, 2012

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.

#include <WTypes.h>
#include <comutil.h>
#include <string.h>the BSTR. Tried SysAlloc, didnt work.

[code]....

If I pass a String to a BSTR as a parameter then pass it back again (like the file name) then the VB side reads in the entire string.

View 1 Replies

Call A Function That Returns A Value?

Apr 28, 2012

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]...

View 6 Replies

Code Returns Zero As Result

Nov 14, 2011

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

[CODE]....

View 14 Replies

CPU Performance Counter Always Returns Zero?

Mar 29, 2010

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.

[Code].....

View 3 Replies

Dataset Returns Null Value

Mar 1, 2010

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]

View 6 Replies

DB/Reporting :: Get Value That SQL Command MAX() Returns?

Jan 21, 2010

the sub I right now is this:

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?

View 1 Replies

Endupdateresource Returns Error 5?

Aug 9, 2010

access is denied error thought updateresource returns true value and i am running vb.net as admin

View 9 Replies

File In Returns Null

Oct 27, 2010

Rather interesting bit on this one, I have all the code where it should be working but whenever it hits parse1 it returns the file as null. [code] I probably just need a fresh pair of eyes because I'm not seeing where this is glitching (...or if it's just my computer in this case.)Rather annoying at this point, tried break points and following the execution to catch the error but no such luck.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved