VS 2008 Funtion Which Takes Two Integers And Returns One Integer?

Apr 22, 2011

implement MOD(%) function without using the MOD or %. Function should take in two integers and return one integer.

View 2 Replies


ADVERTISEMENT

Returns The Smallest Value In An Array Of Integers?

Mar 30, 2011

how to write a function in VB that returns the smallest value in an array of integers?

View 2 Replies

VS 2010 SerialPort.ReadChar() Takes Hex Returns Decimal?

Nov 18, 2011

I am working on a simple vb project to read data from a PC serial port and write that data to a file.The data is ascii sent in Hex format. I used MySerialPort.ReadChar() to read data and MyStreamWriter.Write(MySerialPort.ReadChar()) to write it to a file.

I copied my code below, sorry about the format.The trouble is: MySerialPort.ReadChar() acts the same as MySerialPort.ReadByte() , both takes the Hex data input and returns data in decimal format.I tried to use Convert.ToChar(MySerialPort.ReadChar()) to covert decimal to char, but it's too slow.I tried decimal.ToChar(MySerialPort.ReadChar()), but VB doesn't recognize decimal.ToChar, even after I installed .NET4.

Did I do something wrong? how to make MySerialPort.ReadChar() to read Hex data and return char?

[Code]...

View 8 Replies

Multithreading - Threading Function That Takes Variables And Returns A Datatable

Mar 7, 2012

I've been looking at threading to make my webapplications more responsive. I've found out how to thread a sub that takes no variables and doesn't return anything, but I can't find out how to achieve this for a function that takes variables and returns something. here is an example

[Code]...

View 1 Replies

Takes 3 Percentages(numbers) And Returns An Average Of The Grades In Letter Format(A,B,C)?

Apr 15, 2011

I'm new to coding and i need to make a program that takes 3 percentages(numbers) and returns an average of the grades in letter format(A,B,C). This is what I have so far:[code]......

View 2 Replies

Possible To Check For Existence Of Integer In Set Of Integers Inline?

Mar 31, 2012

In TSQ IF MyVal IN (1, 2, 3, 4, 14) BEGIN ... END .Is there a way to do this in VB.NET? Is it possible to check for the existence of an integer in a set of integers inline? Such as: If MyVal in (1, 2, 3, 4, 14) Then ... End If

View 2 Replies

VB6 DLL Takes Callback As Integer, Requires Delegate Reference Type?

Dec 21, 2009

I have an issue with a third-party COM+ DLL meant to be used from VB6, where it has a function to set a Callback for a hardware event. However, I'm using VB.NET, and AddressOf now returns a reference type instead of an integral type, which means that the setCallback function on the COM+ DLL apparently can't be used.

View 1 Replies

Get A Comma Separated List Of The Integers In The Integer Array Levels?

Feb 15, 2010

What is the simplest/best practices way to get a comma separated list of the integers in the Integer array levels?

Dim levels(5) As Integer
Dim levelsStr As String
'put values in levels'

[code].....

View 2 Replies

Take Two Integers From Two Text Boxes And Put Them Into Two Separate Integer Arrays Then Add Them Right To Left Carrying If Over 10

Dec 17, 2009

i need to take two integers from two text boxes and put them into two separate integer arrays then add them right to left carrying if over 10. here is what i have so far but just looking for the addition i think i can figure out the rest if i get the addition working...

' Project Name: Big Integer Project
' Project Purpose: User enters two integers up to 30 digits each then performs operation.
Option Explicit On

[code]....

View 2 Replies

VS 2008 With Bin2Dec Funtion?

Apr 24, 2009

at first i have to say: i'm from germany. but i'll try the best I have a Bin2Dec funtion:

[Code]...

View 5 Replies

.net - Function That Always Returns The Next Integer In A Sequence

Feb 10, 2012

I need top create a function that gets the next integer in the sequence of 1 to 60. Each time the function is called, I need it to increment from what the last value was and return the next number as the result. It also cannot return the same integer in 2 consecutive calls. When the count gets to 60, the sequence needs to reset back to 1. I would like to function to have no parameters.

I have created a function that does this using the cache to store the last value that was returned, but I am worried that with concurrent calls to the function that it might not work as I expect and 2 calls could get the same integer.

Is cache blocking the correct method to use in this instance or is there something other method I am not thinking about?

Also, stuck using .Net 3.5 and this is a web application.

I just wrote this function based on using SyncLock. Any obvious problems with it that I don't see? I am using the Cache to save the last value that was returned.

Private Shared Function GetNextNumber() As Integer
Dim o As Integer
Dim r As Integer

[Code].....

View 4 Replies

Casting A Boolean To An Integer Returns -1 For True?

Sep 1, 2010

I am working with some VB.Net code that seems to be casting a boolean value to an integer using CInt(myBoolean). The odd thing that is happening is that it returns -1 if the value is true. For example:

CInt(True) // returns -1
CInt(False) // returns 0

Is this common in other languages? I thought that a boolean would be 1 if true and 0 if false. Also, is there a way to make VB assign 1 to true instead of assigning -1?

View 5 Replies

VS 2008 Why Does Click And Move Funtion Does Not Work

Jun 27, 2011

PHP
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Button6_MouseClick(Button6, New MouseEventArgs(Windows.Forms.MouseButtons.Left, 2, 100, 200, 0))
End Sub

[code]....

Why does this function not move the mouse to X100, Y200 and then doubble click?Has it something to do with user32.dll/user64.dll?

View 12 Replies

Integer Arrays - User Enter In Big Integers Using - Two Parallel Arrays

Dec 10, 2009

My assignment is to have a user enter in big integers using what i think is two parallel arrays. I got this far but now im stuck. I think i need to actually convert the text box input into an array but i do not know how to do that. I am all over the place in this project.

'Created/ Revised by: Jessica Falcetta
'Cap 204 Final Project: Big Integer Project
'Project Purpose: To calculate large integers through parallel arrays

[CODE]...

View 5 Replies

Application That Will Display Positive Integers / Negative Integers And Zero Entered In A InputBox

Mar 20, 2010

I tried coding for an application that will display the positive integers, negative integers and zero entered in a inputBox. for some reason it keeps crashing down.here is my code. paging all visual basic professionals. [code]

View 6 Replies

VB 2010 - "3x3 Magic Square" - Use A Function That Returns An Integer Value?

Mar 16, 2011

I have a project to make a "3x3 magic square" and I'm not quite sure how to begin. A magic square is a 3x3 table of 9 values where the sum of the values along any row, column, or either diagonal all add up to the same value.I have to use listboxes to create a form displaying a table of 3 rows and 3 columns whose elements can be individually updated. The solution should have the following features:

- a procedure that initializes a Listbox to hold the value "?", representing the value "undefined", in each of its locations. The number of locations should be provided as a n additional parameter.

- a procedure that will update the contents of a listbox by replacing the currently highlighted entry with a value provided as a second argument. The program should at most have at most one entry among the listboxes highlighted.

I am trying to use a Function that returns an integer value: -1 if not all the elements on the table contain values, 0 if the rows/columns/diagonals don't sum up to the same value, or the sum common to all the rows columns, and diagonals is returned if everything is alright.The user will enter a 3x3 set of numbers. The program will monitor the status of the table as values are entered and displays the status in a textbox that describes if a magic square currently exists. If not all the entries have been made to the table, then the textbox should display a message indicating so.

View 1 Replies

Array Of Integers Comparing Integers?

Feb 2, 2012

Basically I have and array of integers that vary in size. I need to compare each number to each other number and display which number is repeated. For example:

Dim ints() As Integer = {1,2,2,5,4,6}

The number that shows up more than once is 2.

How can I run through the array and compare each integer with the numbers in the array. I tried a for loop but it didn't return the value I was looking for.

View 3 Replies

Calling Function A In Funtion A?

Jul 5, 2009

I have this simple function (below) that randomizes number between 1 to 10. This function works well, except when Random() returns 5, which means intLot=5, randomizeAgain = true, and then the same function RandomizeNo will be called to randomize again. (refer the code below)

Even the new value of intLot equals other than 5 next time, say 4, the funtion returns 0.

I have no idea why. Function RandomizeNo(ByVal totalLot As Integer) As Integer

[Code]...

View 4 Replies

Constantly Returning A Value From A Funtion

May 12, 2009

How would one receive a value from a function while it is running?

View 2 Replies

Make Tab Index Funtion?

Aug 23, 2009

heres the funtion:
Private Sub Tabs_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tabs.SelectedIndexChanged

[code].....

View 9 Replies

VS 2008 For Loop With Integers?

Jul 30, 2009

I currently have a grid of 30 buttons, (6 x 5). So I named them btn1_1 - btn6_5

When the board loads up (this is for a jeopardy game) I have this

code
For counter = 0 To 5
Btn1_#.text = counter * 200
Next

Is there ANY possible way to do that (replace # with the number of the counter.) I doubt there is, but it never hurts to ask!

As a side note, where is a good place to post the jeopardy game that I am making in these forums, i tried both the code bank and gaming forums but they are dreadfully inactive.... since it is in VB.NET, i was wondering if i could post it here.

It is still in the making, but I would really like some feedback as i worked hard on it and got stuck for 6 hours on the save/load feature that was getting messed up cuz of a difference from A and a lol.

View 18 Replies

Button On Program Doesnt Seem To Funtion On Another PC?

Jun 22, 2012

Ive created a program for work which is very plain and simple, a problem i have been having with it is that the OK button. the OK button deletes a key from registry and copies a pdf to the desktop and also creates a .txt file in a folder and as well closes the program. This seems to work on the machine that i have created it on and also from a Flash drive but when i have the folder and program on another PC every button works apart from the OK button.

View 2 Replies

Multithreading Proxy Checking Funtion?

Feb 7, 2012

I was just trying to program a multi threading proxy checker it all work perfect with list box but at last when it finish checking it just crash the application due to multi thread i have try ed lot but didn't get any success cathis my code thanx.

#Region "check proxy"
Const Tc As Integer = 1
Private _ThreadCount As Integer = Tc

[code].....

View 3 Replies

VS 2005 Create Loop For Funtion?

Jan 9, 2011

I am using the following code to return the long and lat of a property, how can I create a loop to return the same for multiple address's?

[Code]...

View 10 Replies

VS 2008 - Anyway To Time How Long It Takes A Message Box To Pop Up?

Sep 9, 2009

I'm trying to time how long an operation takes in Visual Basic (VS 2008) but its not working. the code I have is as follows:


[code]...

this is in an OnClick event, so what happens is that the user can click a menu item, and it goes and sends any changes it has to a database, and pulls down any new changes to a local data cache. This operation takes time, depending on how many changes are on the server and how many are cached locally. I've thought about making this a background task, so it doesn't draw away from the main app while it's running, but before doing that, I'd like to get an idea how long the operation takes. Since I can't exactly do a progress bar, I figured using the stopwatch would tell me how many ticks/milliseconds would occur between click, and when the "total synced" message comes up, but every time i run it and do an update the message always shows 0 ticks/ms. I don't think it's accounting for the delay, just from start to finish. Is there any way to make it so it detects a message popping up and times off that?

View 6 Replies

VS 2008 Seeing Long It Takes To Copy File

Aug 12, 2009

Here's the (Timer1's interval is set to "1" in the designer, and it is set to "Enabled" in the designer as well.)

vb.net
Public timeElapsed As Int32Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
timeElapsed = 0
Timer1.Start()

[Code]...

The issue is, timeElapsed always comes back as equaling 0, so fileCopySpeed always equals infinity. Also note that test.dat is a 100MB file. There's no way it's getting copied in under 1 millisecond!

View 12 Replies

VS 2008 Date And Integers On Sql Statement?

Jul 10, 2009

I got a quite a big sql statement and I get errors when dealing with dates and numeric values. All of this is in order to copy the data to a new table.so these variables I am trying to use for passing the data:

Dim orderdate As Date 'on my sql orderdate is datetime
Dim custntitle As integer 'on my sql is numeric(2,0)
Dim country As Integer ' on my sql is numeric(3,0)

for the date I get an out of range exception,and for these two integers (custNtitle, country) I get invalidCastExceptions when dealing with strings there's no problem but dates and numbers causes errors for me?

Imports System.Data.SqlClient
Public Class Form1
Dim serviceid As String

[code]....

View 10 Replies

Zoom / Magnify Funtion For Unknown Control?

May 26, 2011

I have a Application that has a web control that loads a map from internet on a timer.what I need is to have a designated part of that blown up so I can see it better, think of it in this term, a map of the USA displayed and I want to draw a box around a state and display that in a seperate box and have it say.. 3x bigger.heres the original pic strait from the web now it displayes it just like it displayes it here, and I can draw a square around where I want it to zoom just so the user knows what area is zoomed, and this will be able to be turned off/on as it isnt really coded to do anything its just a visual aid and this pic below needs to be the result on the same form just out beside the webpage, I can have it load to a picbox, or another control that loads images Note that this was done with a photo program manually, I dont know how to code something like this.you Know Your Addicted To Computers When - Your main computer is a 7 terabyte, Core2Quad 3 Ghz +, with 4 or more gigs ram, over 200 programs installed, and you would rather sit with it programming than go to the movies!I've got 13 PC's in the House and 7 are in my bedroom and my main one exceeds this set of stats.

View 14 Replies

VS 2008 - Web Services Application Takes FOR EVER To Build / Run Using Windows 7

Jul 6, 2010

I'm a relatively seasoned VB (COM) vet but this is my first VB.Net application and as is my luck a web services application feeding off a site that I can't publicly mention nor can I post any code that may expose the site.

So, here's the problem. I have written a simple form and have 2 buttons. 1 button simply asks the webservice for it's version. This works no problem. I was able to load the web reference using their supplied WSDL file for this "version" class. Now that I have that working I think "GREAT, that was straight forward. I have my credentials, urls, etc working, the rest of this should be just as straight forward." (See where I jinxed myself here?)

Anyway, I move onto the next WSDL and set of classes and get that reference added no problem. (Man that took a LONG time, like 20 minutes.) I then build my "Get my order data" code syntaxes on the prescribed exposed classes and run my project just to see what errors I get. The "run" process takes almost 45 minutes to an hour..... It's as if the app is getting the WSDL set all over again but doing it over and over..... I have no clue what's going on.

I've tried to disable all the Windows 7 "potential" issues, UAC, firewall, etc, but these changes don't help. Anti virus, spyware, etc all these are off and no difference. I'm running VS2008 as an Admin, right click "run as admin", and have complete control over this machine. Any ideas, suggestions, etc are VERY welcome and I am happy to expose as much of this application as I can providing I can stay with in the rules of the confidentiality contract.

View 1 Replies

VS 2008 Get Administrator Members Takes A Long Time

Apr 18, 2011

I am using the below code to get the local Administrator members, but this code takes about 6-7 seconds to execute. More precisely the "GetObject" takes that long.Is there another way to get the same information but faster?Also, where can I find what other properties the objects holds ? (To see what other useful information I can get)[code]

View 1 Replies







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