Which One Cannot Be Considered As A Counter Variable
Feb 15, 2012which one cannot be considered as a counter variable?
counter = counter +1
counter = counter -1
counter = counter +3
counter = counter *2
which one cannot be considered as a counter variable?
counter = counter +1
counter = counter -1
counter = counter +3
counter = counter *2
how to add a counter variable to this array? My code always stops when it gets to an empty array. I can't figure out how to make a counter variable to make it stop.
Private Sub btnTwo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTwo.Click
For Each i In PlayerArray
[Code].....
I have a master page with the following vb code in the code file...
Public Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
If Not IsPostBack Then
If Session("key") Is Nothing Then
[code]......
What is the value of the variable named counter after the following statements are executed:
Dim percent As Double = 0.54
Dim valid as Boolean = True
Dim counter As Integer = 1
[code].....
I have the following code
Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim counter As Integer = 0
Dim t As DataTable = DirectCast(Session("MyDataTable"), DataTable)
Dim row1 As DataRow = t.NewRow()
If (isUnique(t) And counter < 30) Then
row1("ID") = counter + 1
[Code]...
I have nine pictures that I need to animate -I need to use the ToString method and a counter to concatenate a file name into a string variable from the Image.FromFile method. Once the counter reaches its maximum value, and the last picture is displayed, the counter should be reset to zero or one depending on how the first image file has been name. Also a static counter variable should be incremented in the time routine. what I have so far -- I know what I have to do; however, I just do not know how to code this properly.. Right now I have this going thru a button procedure but it needs to go through a timer.
[code]....
I have this code sample from a book I'm reading which looks to be incorrect:
Imports System.Diagnostics
Sub Main
Dim pc As New PerformanceCounter("PerfApp", "Clicks", False) 'excepiton here
pc.Increment()
counterLabel.Content = pc.NextValue().ToString()
End Sub
There excepion message I get is: The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly. I looked for a property to see if I can set it but couldn't find one.
During the design of a new application I was wondering if using a module with properties is considered to be a bad practice. Some example code:
Module modSettings
public property Setting1 as string
public property DatabaseObject as IDatabaseObject
End Module
The code above is just an example to emphasize my question. In the past, this structure was used a lot in VB6. In the past I used it as well in my .NET projects.
But nowadays with buzzwords like Dependency Injection, Testability and Separation of Concerns the above structure smells bad. I can't really describe why, but it just feels wrong. I must admit I'm not very familiar with the keywords above, yet.So I'm wondering whether the above code really is a bad practice. If so, what would you use a Module for?
VB.NET has classes and Modules, so my first question is what is the difference? Also, I noticed that C# does not have modules, but just classes, is there something in place of modules or were they removed for C#?
View 1 RepliesYou need to test for the backspace character, and if it's there, fix up the input.Maybe something like this:
If Right$(TxtQP.Text, 1) = vbBs Then
TxtQP = Left$(TxtQP, len(TxtQP)-1)
End If
Or is the backspace not showing up in the string, but as the input character kicking off your procedure?
I use to use Structures quite a lot in the VB6 days, and try to avoid them now with .NET. Just wondering if using structures in 2010 instead of a Class is considered nasty?
View 6 RepliesI'm just wondering why using GoTo<label> is so frowned upon?I'm learning VB, and I want to develop good habits as I go. One thing I don't entirely understand, is why everyone avoids GoTo like its the plague (except in error handling...). I feel like GoTo could be useful in some situations.
View 1 RepliesWhy after you pressed the button Button1, this application crashes without considering the event timer1??
Public Class Form1
Public timer_event As Boolean
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
timer_event = False
Timer1.Interval = 3000 '3 sec
[Code] .....
When was isnumeric considered legacy code? I guess all that i have learned from my college class last semister is legacy.
View 4 RepliesEver since I started using VB.Net I have been using the Generic List collection List(Of <Type>). Arrays, I haven't used so much. I used them a lot more when I wrote C code years ago.
1.) Are arrays considered a type of collection like Lists, Dictionary, Queue etc are? Or are they in their own category.
2.) Can I iterate over an array with a For Each loop like I can with other collections or do I stick with the normal For loop for arrays?
3.) There are certain methods that return arrays. Can I set a list object to hold this return value instead of an array?
how i could add like a counter sorta thing, like i know i would declare like lets say AttemptsDone as a integer then i say it = 0 then during my script do i just do like AttemptsDone = AttemptsDone+1 ?
and if thats correct then how do i have it display on my form? like what would i use? textbox? or what and how do i have it change everytime attemptsdone is changed
i got a problem with my one dimensional array and i don't know how to use array of counter.. i have
write the coding into my vb application and my coding did not work as i want. i have think all night
and here is my coding and i not sure whith my coding.[code...]
I am new to VB 2010 and am trying to create a digital calculator program.
I need to know the code that will allow me to creater a counter that holds
the first variable while I enter the next variables, and push the calculate button
to calculate and display the proper answer in a textbox or label.
i wanted to know how to create a for...loop...and specify the counter for the loop to control the animation time. I want the for..loop to increase the speed of the moving object (button) and move it 5 times...
the code i started with is
Private Sub ForNextButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xForNextButton.Click
For Counter = 0 To 1000
'do somtething----the something i want to do is repeat the moving process 4 times and at a fast speed---how do i write that
Next
[code]....
Code:
Public Class Form1
Dim dblPrice As Double = 0
Dim dblTotal As Double = 0
[code]...
I'm trying to get a counter going for radiobutton 3 which will allow the user to add an extra child or adult for a set price any one know how I can do this.
I am planning to keep timer in the form to start from 1 and increment every second. This timer shiuld stop when the other events are triggered in the form (like clicking a button etc).
View 1 RepliesI am getting the error:"Range variable 'sender' hides a variable in an enclosing block or a range variable previously defined in the query expression."for this
Imports System.Data.SqlClient
Imports System.Linq
Public Class Form1
[code]....
I can select any other item from the table without the error. "sender" has the same properties as "receiver" in the SQL table.
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].....
I have recently started creating a basic game however i am having some trouble creating a time counter. Basically what i want is a counter which is a label displaying say "05:00" as in five minutes. Then when the level is started i want it to count down to zero and make my game over label visible.
View 2 RepliesHow to make my counter work. I keep feeling like I'm putting it, or maybe just part of it, in the wrong place so I've been moving it all over the place but haven't found anything that works yet. I'll paste my code below and it will be the code that seems to not stop when it reaches the end of my counter. Other ways I've tried it make it stop after one or two, depending on what I did to the code at them time.
Here's what I have at the moment:
Public Class mainForm
Dim guessCounter As Integer
Dim correctAccumulator As Integer
Dim totalAccumulator As Integer
Dim answer As Integer
[Code] ......
i want to know how to put an auto update for my URL counter
View 4 Replieshow to make a Click counter, every time i clik a button on a form, the label that show a counter will increase.
View 4 RepliesI am a new vb.net 2005 user and new to this forum.i need to know how u can pass a counter from one form to the next.am developing a computer based test and questions are on different forms so i need to know how the mark for a test can be maintained and added to from one form to the next.
View 6 RepliesPrivate Sub btnBeginScan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBeginScan.Click Dim db As New byrndbDataContext
[Code]...
The progressbar runs perfectly, but the lbImagesScanned.Text isn't updated until all the scans are completed.
If I have a double variable that goes through a loop and gets numbers added to it, is it just as simple as saying variablename = 0 to reset it?
View 1 Replies