VS 2005 : Declaring Clearing Passed Values?

Nov 1, 2009

I'm just learning VB and enjoying it, but I have run into a problem with a recent program. I am working with passing values. There is a button on my form that is pressed each time the user "votes" for an option. The problem is I'm declaring my variables in the button press action, then calling my subs/functions.

This seems to be re-declaring my variables each time the button is pressed causing the total counters to fail to increment. I wrote the code for a very basic example of what I am running into in my more complex program.

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim intGenericValue As Integer
Call GenericSub(intGenericValue)

[code]....

View 3 Replies


ADVERTISEMENT

Declaring And Integer As Two Values

Jan 13, 2011

I'm working on a simple BlackJack (player vs dealer) system, that I plan on making gradually more advanced. However, while everything works brilliant, I'm yet to find a logical solution to declaring an Ace as both 1 and 11.So my question is, how do I pull this off. Below is the "New Game" logic (code) so it should give you an idea of what I'm working with (note how player scores are added together, I'm sure it's easy enough to understand...).I'd like lblPlayersum to still be a usable integer, though I'll rework everything if noone has a logical solution.Just quickly note that the "Cards" array is purely used to coordinate images."CardsVal" coordinates that values within the deck. Arrays 48, 49, 50 and 51 are the aces. (Currently defaulted to 11).[code]

View 1 Replies

Update Access DB With Passed In Values?

Mar 11, 2010

I am currently working on a project that requires an update within an Access Database. There are photo folders, and the user defines the path name via a dialog box. That path name is stored to a string value, and through OleDBReader, the actual name of the photo (from another column in the database) is stored to another string value. Anyway, I have tried a number of methods to update, and nothing is working, here is my code from the OleDBReader on, and the procedure designed to do the update. (note that TargetID represents the primary key of the access DB.. this is why I pass that value in because I can use the Rows.Find(PK) method.. When I use a simpler updating method, I get an error saying I do not have a valid update command). OK Here is the code:

Dim photoSQL As String = "SELECT * FROM PotentialTarget"
Dim oleDbCommand As OleDbCommand = New OleDbCommand(photoSQL, tableConn)
Dim oleDbDataReader As OleDbDataReader = oleDbCommand.ExecuteReader()

[Code].....

View 5 Replies

C# - Object Being Passed Using Webmethod, Loses Some Values But Not All?

Jun 22, 2011

when calling a webmethod

[WebMethod]
public Profile synchronize(string MID, DeviceUploadData data)

The object DeviceUploadData has many properties, and a few of them are array's. My question is about the array specifically. It loses it's value once it's received on the webmethod end.This is the property inside DeviceUploadData

Private data() As DataObject
Public Property Data() As DataObject()
Get

[code]....

So the DataObject is populated with data, then once passed, on the other end, some of the DataObject properties are no longer populated. I haven't included the other properties in this example.

View 1 Replies

DB/Reporting :: Selected Values From Comboboxes Not Being Passed To Connectionstring?

Jun 10, 2008

Once again I have hit a brick wall here. I have a combobox in which the user types the server name and then clicks on button 'CONNECT' to populate the next combobox which contains all the databases in that
server. Then after the user selects a database, I have another button that he/she click and I want to retrieve file groups from a specific table. At this point when he/she clicks on that button I get an error: "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"

[Code]...

View 1 Replies

Code Only Works Successfully When Passed The Same Values About Half Of The Time?

Sep 25, 2010

I have a situation that has puzzled me for weeks. I am running logic that does a bit of back and forth to and from the database for each time it is executed (about 20 times). The problem is that the same code works about half of the time. What could possibly be the reason for the difference in execution performance and how can I better shore that this problem is checked?

View 1 Replies

Error 5843 - One Of Values Passed To This Method Or Property Is Out Of Range

Apr 18, 2011

I've mainly been recording keystrok macros... I created visual basic code that allows the user of a template to hide table gridlines - which works fine. The code to show gridlines does not work if the table has only one row. Here is the code - it is getting "stuck" on the
.LineWidth = wd

LineWidth050pt for a horizontal border, as there isn't one. I don't know how to change the code to not execute the command if a horizontal border line does not exist.

With Selection.tables(1)
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = 5592405
[Code] .....

View 2 Replies

VS 2005 String Not Being Passed?

Dec 6, 2011

I'm sure there are better ways to do this and i am open to suggestions. I'm not worried about speed i figured get it to work then i could improve it but my problem is mynewstr2 is not being set to the last value of mynewstr for some reason.(probably something silly im overlooking right now). at this point just converting the image to a string i can work with for my very basic ocr.

Public mynewstr2 As String
Public Sub pictostr(ByVal image As System.Drawing.Bitmap, Optional ByVal Mode As BWMode = BWMode.By_Lightness, Optional ByVal tolerance As Single = 0)

[Code]....

View 7 Replies

VS 2005 Listview Not Clearing Items

Apr 30, 2009

I am trying to clear the items from a listview, but it is not working. I populate the listview like this (pulling data from a sql database)

[Code]...

View 16 Replies

Asp.net - Prevent FormView From Clearing User's Entered Values After Insert Method Has Fired?

Feb 26, 2010

I have been struggling with getting FormViews to work the way Microsoft expects me to for about a day and have figure a bunch of great stuff out.

I can catch e.Exception and e.ReturnValue in the ObjectDataSource.Inserting Event Handler and I can even cheat and check other properties of the Object in the ObjectDataSource.ObjectDisposing by checking the e.ObjectInstance ... and I even learned that FormView's Inserting Handler Runs AFTER the ObjectDisposing Handler so If there is a problem found I still have time to react to it and st the e.KeepInInsertMode to true on the FormView.

My problem is, it seems that the values entered by the user into the Insert form are cleared regardless.

So, How do I Prevent a FormView from clearing after it's Insert Method has fired?

(Using ASP.NET + VB)

I don't think posting my code here will really do much good and i would have to modify it to trim out confidential business logic stuff... so I'll skip it for now.

edit:

I have found a temporary and admittedly terribly cludgy solution (in case no one ever finds a REAL solution to the problem).

I have a page variable defined as:

Dim eInsertArgs As FormViewInsertedEventArgs

And then I do the following in my ItemInserted handler

If boolInsertErrorOccurred = False Then
e.KeepInInsertMode = True
eInsertArgs = e

[Code].....

The effect of this is that I am setting the values BACK to the submitted values AFTER ASP.NET binds the FormView to the default (blank) Template.

View 1 Replies

VS 2005 Declaring Member Order?

Dec 28, 2009

Is there some way to get the declaring member order inside a class? For instance:

Public property Number1() as Integer
Public property Number2() as String

I need get the exact order. Maybe using reflection or something else

View 2 Replies

Can A Generic List Of T Be Passed To Function Similar To Way An Array Is Passed?

Mar 23, 2012

I want to pass a List of T where T is an object I've created that has about ten properties (strings, dates and integers).The lst passes to the function successfully. I am also passing an New T of the Object (itm as T).I can see all the values (see image below), but because it's generic I cannot seem to retrieve the property values and I cannot figure out how to iterate through the properties of each itm as they are retrieved in the For Each.[code]

View 10 Replies

Exclude Multiple Values In Sum Depending On Values In 2 Columns In SSRS 2005?

Apr 21, 2009

I have simple columns and their respective sums. However, I exclude 1 particular value from each sum, like so [code]...

Now I need to exclude another value ("Awaiting Progression") from a second column called "PROGRESSION".

Since I already exclude value based on 1 column called CATEGORY, how do I change my =Sum(Code.ExcludeOthers(Fields!CATEGORY.Value,Fields!ACTION_PLAN_NEW.Value)) to exclude a value from the PROGRESSION column if it's = ("Awaiting Progression") ?

i.e. How do I exclude multiple values, depending on values in 2 columns in SSRS 2005?

View 1 Replies

Add Some Values In DataGrid In Vb 2005?

May 18, 2009

add some values in DataGrid in vb 2005 no code because i want some sample how to do it. I drow a DataGrid in my form i set Column name and Headers now how to add some values in them

i try this but nothing hapen

for i = 1 to 15
grdTest.Rows.Add

'I need thsi part here where you set column name and the value to insert

next i

View 11 Replies

VS 2005 - Get Set Of Values In One Msgbox?

Nov 17, 2009

This piece of code is returning the multiple values of Category in MsgBox one by one. How can i make it to show all the values of category in one MsgBox separated by commas and store it in a String?

[Code]...

View 7 Replies

VS 2005 Swap The Values Of A And B?

Oct 20, 2009

I have tree buttons (or maybe textbox's) when i click on button: A and then on button B , i would like to swap the values of A and B. Then if i click on C and on A i would like to swap the values again. This is for either a button or textbox. I think the code should be similar.

View 2 Replies

Assigning Values And Calculation In VB 2005?

Feb 28, 2009

I want to assign values to ifitems in a combo box B brand "ex. Focus = should be $200": items in comb box C "specific years ex. 2006" ANDuse this information to calculateInitialPrice

1. The "InitialPrice" is the default price for the selected brand and model of a car in 2006. I'ved used this code but it's not working.. or am not understanding.

[Code].....

View 5 Replies

VS 2005 - Populating Values From Database

Jan 21, 2010

I need to populate values from a database(Access) in to vb.net form. after selecting a field from first form, the next form should display all the parameters used in the selected field from the data base. Also if do editing it should be updated in the database.

View 4 Replies

VS 2005 : Changing Date Values?

May 26, 2010

I have one hour format datetimepicker and other short format datetimepicker. When I select an hour from 1:00 AM to 5:00 AM want to change the current day to the day before. I tryed to - 1 day but doesn't work or maybe isn't the correct way to do it.my error says operator '-' is not defined for types 'Date' and integer

here's my

Dim hora As Date
Dim fecha As Date
hora = Me.dtpHora.Value
fecha = CStr(Me.dtpFecha.Value)

[code]....

View 2 Replies

VS 2005 A String Array With No Values?

Nov 19, 2009

I wrote a console application where arguments are passed from the command line to a string array called args()If someone runs the program without supplying any of the arguments, I want to catch this. How do you check this? I was trying this

View 1 Replies

VS 2005 Display Two Values In Combobox?

Mar 27, 2009

i want to display two values from two columns of same database table..i could get only single value..eg...i want to display emp_name and emp_id in the same combobox...i dun want to use another combobox for emp_name...when displayed it should be like "emp name=XYZ and emp id=E123".

[Code]...

View 14 Replies

VS 2005 Error While Populating Pie Values

Feb 9, 2010

Private ReadOnly Property Values() As Decimal()
Get
Dim X As Integer = 1

[Code]....

{"An error occurred creating the form. See Exception.InnerException for details. The error is: At least one element in the source array could not be cast down to the destination array type."}

View 4 Replies

VS 2005 Extract Values From String

Mar 8, 2010

Have following string: PHP Feed.SmulocV2.Equipment,CAT,,DFT08783,2567,Hours,2010-02-07 06:37:41,Lat:35.10495,Lng:-82.99304 The string will always have text "Lat:" and "Lng:". The value of Lat and Lng could in some cases be nothing. Now I need to extract the values for Lat and Lng.

View 11 Replies

VS 2005 Not Saving Values To App.config?

May 10, 2009

I have used the following code to update the app.config file. The code works fine and didnt shown any exceptions, but values are not storing to app.config ?

[Code]...

View 1 Replies

VS 2005 Retrieving Values From Database?

Jun 23, 2011

Im taking over a project that pulls information from a database.Currently I have everything I need except the username.The person who setup the project did it as a web project so he used the MemberShip class to create unique user keys based on the person's username.

The username is not stored anywhere in the database only these userID keys.

The client wants a desktop app that mimics the website behavior of writing to the database.

Problem:I ask the user to enter in a username at the login. The username connects to the database on the server.I have no way of grabbing any user info after this point as the primary key(USERID) is a unique key and not a username. Is there a way to convert a MemberShip ProviderUserkey into a string Username or am I screwed?

View 1 Replies

VS 2005 Save Values To Combobox?

Aug 19, 2010

I have a combobox which contains few objects in Items. When the user selects any item from the combobox the values from the Object member variables are stored in the textboxes on the form.The user will change the values in the textbox and then he will select another item from the combobox.

View 10 Replies

VS 2005 Textbox Values Matching?

Jan 16, 2011

I am wanting to check two TextBoxes to see if they both have the same value. If they don't, then to show an ErrorProvider and do something with some buttons based on the input. I have all the textboxes in a List like so:

vb
Private MyList As New List(Of Elegant.Ui.TextBox)
vb

[code].....

I can go through the list to check if they have a value or not but want to check the last two in the list to see if they contain the same value. This is what I am doing to check to see if they are empty or not.

vb
Private Sub CheckMe() bIsEmpty = False For Each itm As Elegant.Ui.TextBox In MyList If itm.TextLength = 0 Then

[code].....

View 10 Replies

VS 2005 Using The Multiple Boolean Values?

Jun 29, 2010

I have code like the following:

Dim Flag as Boolean
Flag = Function1ReturnValue
Flag = Function2ReturnValue
Flag = Function3ReturnValue

Now ideally 'Flag' should only have a true value if all three of the functions returned 'True', but as it stands now it won't do that. There needs to be an 'and' or an 'or' or an '&' or something like that, but I'm confused as to what needs to be.

View 2 Replies

VS 2005 Way To Allow Values Not In Combobox ListItems

May 19, 2011

I have a DGV bound to a bindingsource with a column that uses a DataGridViewCombobox, that has a DataTable for it's datasource. This all worked fine at first.But I removed a row from the DataTable that the DGV combobox uses as its datasource. Now when I try to load the form that contain the DGV, I get an error "DataGridViewComboboxCell value is not valid" for each row that contains the value I removed from the DataTable.It seems the value of the column must be a member of the combobox Listitems. Is there a way to allow values not in the combobox ListItems. I don't want the combobox listitems to be locked in for the life of the application.

View 2 Replies

[2005] Drop Down Duplicate Values?

Jan 20, 2009

I have a fairly large Drop down menu:

<asp:DropDownList ID="DropDownList8" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList8_SelectedIndexChanged">
<asp:ListItem Value="" Selected="True"></asp:ListItem>

[code]......

View 8 Replies







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