Code Returning Different Values ( C# And .NET )

Dec 2, 2010

VB.NET Code:

Module Module1
Sub Main()
Dim x, y As Single
x = 0 + (512 / 2 - 407) / 256 * 192 * -1

[code].....

returns 0: 0

View 2 Replies


ADVERTISEMENT

Class Not Returning Values?

Oct 15, 2010

i have this class that i'm calling from a telerik report. when debugging asp.net application the report shows the right results but when i deploy to IIS it just return the first row and not the SUM of the salary variable.

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data

[code]....

View 2 Replies

IDE :: Returning An Array Values?

Dec 1, 2009

i have this code:

...
Dim Labels() As String
Dim Count As Integer
Count = 0

[code].....

View 3 Replies

Returning One Or More Values From A Function?

Apr 20, 2010

Is it possible to return more than one value from a function? Like two integers, or an integer and a boolean, or any other data type combination. I understand I could use a sub and set these values in a variable but I was wondering if I could avoid declaring more variables by using a function.

View 28 Replies

Returning Values In Another Class?

Jul 31, 2009

I'm making this game where there is an enemy that goes to the center of the form and grabs an object and brings it back to the side. I made a new class called enemy that makes the enemy. in the class there is a sub called start which the enemy goes to the center and brings the object back. when the enemy comes back with the object i want the integer lives to subtract 1 from it. so i put the

If Not Rect.IntersectsWith(Form1.ClientRectangle) Then
Form1.Lives -= 1
End If

where Rect is the enemy's bounds. when ever rect is not intersecting with the forms bounds (which means when its off screen) lives should subtract 1, but it doesnt.

View 5 Replies

.net - Inherited Classes Returning Different Values?

Jun 25, 2010

This is more of a conceptual question than anything.

I have a base class called "RawReader".

It sets up the framework for classes to inherit it and read in specific data systems.

For example, I want an app read in a known format of FoxPro database, a CSV file, or a SQL database (there is about 8 more formats currently), then transfer it over a webservice and create a SQL database from it.

I have everything working with CSV, FoxPro, Access, Excel, etc... Easy enough.

The classes that inherit RawReader, like RawCSV, RawFoxPro, RawAccess all return a struct that contains a dataset as one of the members. The dataset contains the data from the raw system. The webservice receives this struct and creates sql tables and loads the data into it. This has already been coded and works great.

My issue now comes to reading in SQL. Obviously, I could follow the same path, read the remote SQL DB into a dataset, transfer the dataset as above, etc... My "issue" comes in where I feel like it doesnt make much sense to transfer a SQL db to a dataset, transfer it through the webservice, and then try to programmatically recreate the SQL database. I feel like I lose a lot of the granular details from the SQL database (field sizes, extended info, etc..) It seems easier in practice to just create a backup of the database, convert it to a stream object and transfer the backup over to the webservice. But this is where the problem lies...

Since all of the classes inherit from the base class, they are set up to return a DataSet. The hack-ish way would be to just add a stream object to the return struct and in my webservice add other code to make a special case for SQL sources, but I was trying to avoid that.

Any thoughts on the "proper" way to go about something like this?

View 1 Replies

Class Not Returning Accurate Values?

Oct 15, 2010

look at this class and say why it's just returning just the first row in the second query, the issue is that the Salary is showing the right value when debugging, but when deployed to IIS it's just returning the 1st row

Imports System
Imports System.Collections
Imports System.ComponentModel

[Code].....

View 1 Replies

Function Is Not Returning Correct Values

Jun 18, 2009

Ok simply my code doesnt want to output the correct number. I'm working on the project euler probems to expand my knowledge in VB.net and the current question I am working on is asking to work with triangle numbers. while researching I found that a triangle number can be calculated by using the formula:

[Code]....

View 5 Replies

Idatareaders Not Returning Values From Database?

May 25, 2010

In my codebehind I have this vb:

Dim reader as idatareader = includes.SelectDepartmentID(PageID)
While reader.Read
Did = reader("departmentid")

[Code].....

No Errors are being presented yet nothing is being returned by the reader. Is there an error in my code?

View 2 Replies

Returning Multiple Values From Function

Mar 17, 2009

I am working on a project I would like to use a function in a class I created to return multiple values in order to populate a listbox. I wanted to use a do until loop to achieve this. I will just post a simplified example of what I am doing :

Public Function Listboxfiller
Dim astring As String = "This is a string"
Dim Counter as integer = 0
Do until Counter = 5
return astring
Counter += 1
Loop

Then on the form I would do something like :
lstListbox.Items.Add(Myclass.Listboxfiller)

What happens right now is that the listbox only gets the first value, when I ran through in debug mode I found the loop only runs once, even though it should go multiple times.

View 4 Replies

WCF Service Not Returning Current Values?

Sep 27, 2009

I created a WCF Service running as a console application. It is doing event listening for my workflow engine.The second application I am trying to do is a WinForm that can monitor the service and return me back the current states of the engine's workersI am able to connect to the service fine, and I verified that my service has values being set when I step through it... however when my monitor makes a call to the service, I am returning values as though it is not being run? (So default values, not current values

View 13 Replies

Web Services And Returning Multiple Values

Jan 14, 2009

I am struggling here with introducing web services into a site I am currently working on. The background is as follows.

- I have a page switchboard.vb which will recieves incoming xml requests.
- I parse these xml requests extracting its values, then setting them equal to the relevant global variables in switchboard.vb.
- One of these variables will determine a 'requestType'. Based on this requestType I want the page to call particular web services that I will add.
- These web services will then validate the user calling has permissions to access and execute it.
- The switchboard.vb page will then generate an xml respose which will post to the client.

Here is a summary of the process
getXML()
parseXML()
determineRequestType()
executeRequest()
rebuildXML()
postXML()

The ways I can see to do this are:
1. Pass the variables into the required Function allowing it to pass back a pre formatted xml string.
Pro: Simple
Con: It is not really using the web service as it should be.

2. Pass the variables into the required Function as 'ByRef' values hense changing the original value on switchboard.vb
Pro: allows me to format the outgoing xml on switchboard.vb and gives me more functionality with more individual variables as opposed to one string being passed back.
Con: Is this taking advantage of a web service? When I tried this the web service form didnt give options to input test data. Possibly because I am using ByRef?

View 10 Replies

Returning Multiple Values From A Function Call?

Apr 1, 2010

I have an active directory search function:

Function GetAdInfo(ByVal ADDN As String, ByVal ADCommonName As String, ByVal ADGivenName As String, ByVal ADStaffNum As String, ByVal ADEmail As String, ByVal ADDescription As String, ByVal ADTelephone As String, ByVal ADOffice As String, ByVal ADEmployeeID As String) As

[code].....

View 1 Replies

Asp.net - Returning Multiple Values From A Function In An Parcial Class In VB?

Sep 6, 2011

show me how to return multiple values from a function? I have my function in a seperate file within App_Code and here it is:Public Function GetQuoteStatus(ByVal QuoteID As String) As String

Dim quoteStatus As String
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Try
con.ConnectionString = ConfigurationManager.AppSettings("quotingSystemConnectionString")
con.Open()

[Code]...

However this is all good and well for one returned value but what If I wanted to return multiple values.How do I access them?

View 3 Replies

SQL Possibly Not Returning Values For A Query In Visual Basic?

Jun 29, 2010

In my code I enter a string in a text box and have the query check the server for the entry. If it exists it returns the string and the date into two separate variables. The database only has TrackingNumber and Date. Below is the code. As of right now i get "Invalid attempt to read when no data is present." at the "If (sdr("TrackingNumber") IsNot Nothing) Then" line.

Public Function CreateSqlParameter(ByVal name As String, ByVal dbType As DbType, ByVal direction As ParameterDirection, ByVal value As Object) As SqlParameter
Dim parameter As SqlParameter = New SqlParameter()

[Code]....

View 3 Replies

VS 2010 - Reading Text File And Returning Values To Textbox

Apr 17, 2011

I've a got a homework assignment that chooses one of four values in a list box, stores it in a text file. Secondly, on the display click event it should access the text file, read the line, store it in a variable and then display the totals in a text box. Works sort of fine except that it doesn't display the totals correctly. Code for both buttons is below. The variable are assigned in the mainform (Tried also in the display button and didn't change anything). The save button works fine and stores fine in the text file, it's just the reading that's the problem.

Private Sub saveButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles saveButton.Click
'save the new vote choices to a file
Dim votes As IO.StreamWriter
votes = IO.File.AppendText("votes.txt")
Dim voteSelected As String = CStr(commercialListBox.SelectedIndex)
[Code] .....

View 2 Replies

.Net Code Returning Different Result Than C# Code?

Apr 20, 2012

The following code in C# gives result "228452386"

UInt32 a;
int k = 0;
a = 0x9E3779B9;
a += (UInt32)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k + 3] << 24));

After above code is ran, "a" contains "228452386" But the following same code in VB.Net results in "Arithmetic operation resulted in an overflow". Basically the last statement is returning value "1868983913" so the runtime error is generated.

Dim a As UInt32
Dim k As Integer = 0
a = &H9E3779B9UI
a += CUInt(AscW(url(k + 0)) + (AscW(url(k + 1)) << 8) + (AscW(url(k + 2)) << 16) + (AscW(url(k + 3)) << 24))

note the variable "url" in above code could be any string and it is same for both codes.

EDIT:When I run the following statements in both C# and VB.Net than they both return same value

C#
(UInt32)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k + 3] << 24))
VB.Net
CUInt(AscW(url(k + 0)) + (AscW(url(k + 1)) << 8) + (AscW(url(k + 2)) << 16) + (AscW(url(k + 3)) << 24))

Both statements return value "1868983913" for "url" "info:microsoft.com". But when I run complete statement with a += ..then VB.Net gives error while C# returns value "228452386".

View 3 Replies

Getting Code To Run When Returning From Dialogbox

Feb 27, 2009

i got two forms

form1 (frmUserDetails)
form2 (frmSearchForm)

when i click the search button in form1, form2 appears.

i get the information i want from form 2 and store it in a variable.

when i close form2 and form1 is active again i want this code to run automatically:

[Code]...

View 2 Replies

RegEx - Finding / Returning A Code

Jul 10, 2009

I must admit it's been a few years since my RegEx class and since then, I have done little with them. So I turn to the brain power of SO. . . I have an Excel spreadsheet (2007) with some data. I want to search one of the columns for a pattern (here's the RegEx part). When I find a match I want to copy a portion of the found match to another column in the same row.

[Code]...

View 3 Replies

VB Code For Returning File Properties?

May 24, 2010

I been trying to create a database of files. I wanted to list the Titles and Authors of the files.

How can this be done?

View 4 Replies

Forms :: Getting Code To Run When Returning From Dialogbox Automatically?

Feb 27, 2009

i got two forms

form1 (frmUserDetails)
form2 (frmSearchForm)

when i click the search button in form1, form2 appears.i get the information i want from form 2 and store it in a variable.when i close form2 and form1 is active again i want this code to run automatically:

Me.userIDsearch = frmUserSearch.NuNameTB
Try
'TODO: This line of code loads data into the 'SoftwareLookupDataSet.tbl_software' table. You can move, or remove it, as needed.
Me.Tbl_softwareTableAdapter.Fill(Me.SoftwareLookupDataSet.tbl_software)

[code]....

how would i get the above code to run when the focus is back on form1?

View 8 Replies

Returning Incorrect Http Status Code From Mvc Route

Apr 27, 2011

I have a asp.net mvc route that is taking a url and doing a simple get and return the status code from the request.

<AcceptVerbs(HttpVerbs.Post)> _
Public Function ValidateUrlStatusCode(ByVal url As String) As ActionResult
Dim code As Integer = 0

[Code]....

Now if I use firefox (using Firebug) and go to the url http://www.facebook.com/blah.html, I get the expected 404 returned. However if I use my application to call the mvc route via an ajax call, I get 200. If I set the request object's AllowAutoRedirect to false, I get 302. I never get a 404. I am verifying this once again through Firebug.

View 1 Replies

Returning Incorrect Http Status Code From Mvc Route?

Mar 19, 2010

I have a asp.net mvc route that is taking a url and doing a simple get and return the status code from the request.

<AcceptVerbs(HttpVerbs.Post)> _
Public Function ValidateUrlStatusCode(ByVal url As String) As ActionResult
Dim code As Integer = 0

[code].....

View 26 Replies

Android - C2DM Code Snippet Returning Error=MissingRegistration?

Dec 19, 2011

I am using the tutorial laid out here http://www.androidsnippets.com/vbnet-server-side-code-to-send-c2dm-messages to attempt to send a message to my device. I have requested a device ID and placed that string in the RegID String.I receive a (what looks like a) GUID for the googleAuthToken successfully, but when the rest of the code executes,the response I get is Error= MissingRegistration. What exactly am I missing to implement C2DM from a server via VB.NET?

View 1 Replies

Asp.net - Returning In Oracle INSERT Is Not Returning Proper Value?

Mar 15, 2012

I have an ASP.NET web application (VB.NET) using an Oracle database. On an insert, I need to get the identity of the inserted row back. I am trying to use RETURNING, but I keep getting a value of 1 returned.

Dim strInsert As String = "INSERT INTO L.TRANSACTIONS (LOCATION_KEY, TRANS_CREATOR, TRANS_EMAIL, TRANS_PHONE) VALUES (:location_key, :trans_creator, :trans_email, :trans_phone) RETURNING TRANS_ID INTO :ukey"

[Code].....

View 2 Replies

Returning A Function Vs. Returning Variable Name?

Dec 12, 2011

My brain may just be fried since it's the end of the semester, but my teacher kicked this back to fix and resubmit...she said that I am "returning the name of your function rather than your variable name".

Here is my code for all 3 forms.

code:

These are forms to calculate the cost of getting a cell phone package.

View 6 Replies

Asp.net - Using Values From SqlDataSource In Code Behind?

Feb 27, 2012

After the SQLDataSource gets the values from the database, I want to be able to use these values in the code behind. Kindly spare 5 minutes and give me some suggestions.

[Code]...

View 3 Replies

Can't Able To Insert Values Using Code

Mar 26, 2009

[code]...

created table using microsoft sql database fileinto

View 2 Replies

What Other Code Page Values Can Be Used With Getencoding() In .net

Mar 21, 2009

what other code page values can be used with getencoding() in .net?

System.Text.Encoding.GetEncoding(1252).Getstring()

View 2 Replies

Handle Null Values On One Line Of Code?

Mar 30, 2011

I need to round and print a price like below, but this does not handle null values.How can I handle null values on one line of code? DBRSet is an SQLDataReader and the price is money

<%= Math.Round(DBRSet("price"))%>

I have about 200 .aspx pages of this so I could also use some tips on how to change these in an easy way? Can I do a search and replace with a reg-exp or something like that?

View 2 Replies







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