IF Then Statement Not Working Correctly Where Value Is Nothing

Feb 27, 2012

MVC3 VB.NET application. I have the below section of code in a function. This code is supposed to only fire if the handout1 is not nothing. But for some reason it is going into the then block when the handout1 is nothing in the database... I have tried a hundred different ways of checking but it is still trying to run that line of code even when there is nothing to assign to it....

[Code]...

View 2 Replies


ADVERTISEMENT

Asc Command Not Working Correctly

Dec 13, 2009

I have been making a text based noughts and crosses game and trying to convert an alpha grid reference into a number to run the logic sequence that decides whether the an input is valid. I am using the asc command to convert but it just keeps putting up the error: Conversion from string "a" to type 'Double' is not valid, when it reaches the line If (Asc(Left(choice, 1)) >= 65 And Asc(Left(choice, 1)) <= 67) Or (Asc(Left(choice, 1)) >= 97 And Asc(Left(choice, 1) <= 97))Choice is the input and has already been checked for length, whether it contains an alpha and numeric input (and where they are) and whether the numeric value is valid.

View 1 Replies

SQL Statement :: Nearly Working Just Cant Get Form Values In Statement?

Aug 4, 2010

I cant get this SQL statement to insert any of the values in the form to add to the database

sql
sql = "INSERT INTO prevresults (ExamDate, ExamTime, CorrectAnswers, PassPercentage) VALUES (date.now, time.now, rightanswers, percentage.text)"

[code]....

View 4 Replies

.net - Creating An (VB) APP And It Isnt Working Correctly?

Apr 11, 2012

I am at college and am creating an app. however i have two main problems within my app. my app is a pizza app which will allow staff within a pizza shop to send the orders to the kitchen (this is just a listbox).but, the math doesnt work, the correct pricing isnt being displayed in the label for the orders for some reason. I have tried different ways of writing and placing my code but the result is always the same. also, i have five customers per table. if i select all the customers orders and click on send, only customer two's order will be sent. not any of the other customers, but if i just do customer one on its own, it works.

[Code]...

View 2 Replies

ContextMenuStrip Sub-Items Not Working Correctly?

Feb 13, 2009

I have a context menu strip associated with a listview. Everything work just fine however one of my menu options on the context menu strip has a pop-out menu (you know, you hover over the selection, and another menu strip expands out).I can seem to get these to work correctly.

Public Sub ReleasedToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReleasedToolStripMenuItem.Click
FileEntries(ListViewSelectedIndex).Status = "Released"

[code]....

So I changed my sub to read as the one VB created, and still didnt work. So I went back to edit the context menu, double clicked "Reserved" menu items, then VB creates a sub w/o the _1 (like I had before).Also the check-box status for these menu items works fine.

View 1 Replies

Format() Not Working Correctly In 2010?

Feb 1, 2010

I have the following function in my program:

Format(Now(), "yMMdd" & "hhmm")
in 2009 it produces 912311200 for 12/31/2009 12:00
in 2010 it produces 1001011200 for 01/01/2010 12:00

It is giving me a 2 digit year. How do I get a 1 digit year?

View 4 Replies

LINQ To SQL Update Not Working Correctly

May 11, 2009

I use the following statement to position which row to update;
Dim salonToUpdate = (From r In db.Salons _
Where r.StoreID = storeID _
Select r).Single()
If fileDate = #1/1/1900# OrElse fileDate = Nothing Then
SalonToUpdate.LastDownLoadDate = TableDate
[Code] .....

I've double checked to make sure none of the dates are invalid or null, but when the bolded statement executes, the following sql runs through the trace:
exec sp_executesql N'UPDATE [dbo].[Salons]
SET [LastDownLoadDate] = @p0
WHERE 0 = 1',N'@p0 datetime',@p0='2008-01-04 00:00:00:000'
Of course it's going to fail if LINQ is passing in where 0=1 every time. Shouldn't it be using some unique row identifier, (in my case, the salon id), to update the specific row?

View 2 Replies

Text Box Max Length Not Working Correctly?

Mar 16, 2010

i have a text box that has a max length of 5. when typeing into that text box the character input stops on the 5th character. if i set teh text property to a sting that has more than 5 characters the text box accepts the string. in vb6 i think that the text box would truncate the string to 5 characters.

does anyone know of a way to truncate, or get the text box to only accept the maxlength of the text box

View 4 Replies

VS 2008 DataRepeater Not Working Correctly

Nov 9, 2011

[[code]I have this issue where most of the rows in the table do not fill in the data to textbox2 and any edits made in the text box when this happens do not commit to the underlying datasource.When scrolling down and back up the datarepeater different records seem to be shown each time the data on the left is correct in the standard DGV ... it's just the data repeater that doesn't work.

View 1 Replies

Asp.net Mvc - .NET MVC Localization (resourceprovider) Implementation Not Working Correctly

Jan 11, 2010

i'm currently implementing a localized website. I've created a custom ResourceProvider + Factory for storing resources in a database. This all works, i'm storing data as follows:

[Code]...

View 1 Replies

Colouring Datadrid Rows Not Working Correctly

Feb 1, 2012

This issue is driving me nuts. Yesterday it was working perfectly but unfortunately I deleted the form by mistake and I had to build it again. The form contains a datagridview and I have the following code on the Load event:

HTML

Private Sub GUIAS_ConsAd_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.ADIANTAMENTOSTableAdapter.Fill(Me.GUIASDataSet1.ADIANTAMENTOS)

[Code].....

The same code on the Sorted event of the datagrid produces the same effect

View 4 Replies

DateDiff Not Working Correctly When The Date Has Time Specified In AM/PM?

Jul 22, 2009

I found very wiered behaviour for DateDiff. or any other kind to date difference methods avalibale when Date has AM/PM specified in it.

Cl.LunchStartTime =
"2009/7/13 12:10:00 AM"
Cl.LunchEndTime =

[code].....

View 2 Replies

HTML Tag Replacement Regex Not Quite Working Correctly?

Sep 14, 2009

This is a follow up to another question of mine. The solution I found worked great for every one of the test cases I threw at it, until a case showed up that eluded me the first time around.My goal is to reformat improperly formatted tag attributes using regex (I know, probably not a fool-proof method as I'm finding out, but bear with me).

My functions:
Public Function ConvertMarkupAttributeQuoteType(ByVal html As String) As String
Dim findTags As String = "</?w+((s+w+(s*=s*(?:"".*?""|'.*?'|[^'"">s]+))?)+s*|s*)/?>"

[code].....

View 2 Replies

Splash Screen VS2010 - Not Working Correctly?

Nov 8, 2011

Splash Screen VS2010 - Not working correctly

View 15 Replies

VS 2010 Timer Among Other Things Not Working Correctly

May 17, 2012

Ok so on my project it seems the timer is not working correctly, the interval is set to 5000 (which is 5 seconds... right?) so every 5 seconds it would display a MsgBox telling me the current date/time and then a time in a list.

[Code]...

View 4 Replies

AjaxControlToolkit Asynch File Uploader Not Working Correctly?

Oct 7, 2011

I have an AsynchFileUpload on my page and for some reason when I try to use it to save the file to the server it falls. The control will allow me to select a file locally and it displays the local file path in its text box, BUT when I then click a button on my page which I am going to be using to submit all details then upload the page everything goes wrong and I get a Null Ref Exception from the AsynchFileUploader.

[Code]...

It seems that the filename is being lost somewhere after the button is clicked, or just never stored

View 1 Replies

VB Drawing Application Not Working Correctly - Run In Is Just A Gray Block

Dec 10, 2009

I'm a college student just starting out programming in VB and am having a lot of trouble trying to get my drawing program to work. Currently i am using Microsoft Visual Basic 2008 Express Edition and whenever i try to debug my program the window it's supposed to run in is just a gray block. I'm not too sure if this is the right place in the forum to post this so if it is just let me know and ill move it. c:

[Code]....

View 2 Replies

VS 2008 Recursive Check For Empty Controls Not Working Correctly?

Mar 24, 2011

I have made a form that consists of textboxes nested in groupboxes nested in tabpages. I want to check if all textboxes are empty in every groupbox and even if the controls from a groupbox in a groupbox are empty.When they are empty i should not create an element string for my .xml document.Below is the code that I have at the moment. I call it with the form as the parameter.

Public Sub recurringControls(ByRef ctl As Control)
For Each c As Control In ctl.Controls
If c.Controls.Count > 0 Then
If c.Tag IsNot Nothing Then

[Code]...

View 1 Replies

VS 2010 See If The Microphone On A PC Is Working Correctly By Utilizing The SpeechRecognitionEngine Class?

Nov 15, 2011

I'm trying to see if the microphone on a PC is working correctly by utilizing the SpeechRecognitionEngine class.I'm using the following

VB.NET
Dim RecognitionEngine As New SpeechRecognitionEngine(New CultureInfo("en-US"))
'Dim synth As New SpeechSynthesizer
'synth.SpeakAsync("Microphone")

[code]....

When I run this code, the microphone runs until it detects a sound. If the room is silent, it never stops. At least so much as I can tell so far.But I need a way to detect when it can't detect a sound within a specified interval.I looked on MSDN and all I could find was a property called, BabbleTime. I can specify a TimeSpan that will time out the speech recognition, but from that, I can't determine if it was the timeout that caused the code to continue or if it detected sound.

View 2 Replies

.net - HTML Input Not Working Correctly With AJAX Update Panels Used Else Where On Page?

May 20, 2010

I have some update panels on my page that do some asyncpostbacks to keep some dropdownlists correctly populated. My problem is that on my page i have an HTML input that is handling some file uploads. With the AJAX on the page with asyncpostbacks, and while i step through my code behind, the files arent being uploaded. Using a postbacktrigger (non-async) is not possible because of my layout.

Here is my code:

<div id="divFileInputs" runat="server">
<input id="file1" name="fileInput" type="file" runat="server" size="50" style="width: 50em"
onfocus="AddFileInput()" class="textbox" /></div>

[code]....

When I put a breakpoint in at the declaration of service and then check the value of "files", the count is 0. I am expecting it to be 2 when i have one file uploaded.

View 1 Replies

Get A IF Statement Working?

Jan 29, 2010

Trying to get a IF statement working.

strUSER = "Test1"

This works.... The exception does not fire

ElseIf Not strUSER Like "Test1" Then
Throw New ArgumentException("Error")
End If

This does not.....The exception does fire

strUSER = "Test1"
ElseIf Not strUSER Like "Test2" Or Not strUSER Like "Test1" Then
Throw New ArgumentException("Error")
End If

I need the second one to work as well. The exception should not fire.Why?

View 2 Replies

If Statement Not Working?

Dec 27, 2010

why can't I do

If ( textbox1 1= " ")
endif

View 9 Replies

INSERT Statement Is Not Working

Jan 23, 2010

I am creating a feature in my application that will allow a logged in user to add additional users to be logged in. The usernames and passwords are kept in a single database created in Access 2007. The table has 3 columns: ID, UserName, and Password. I am trying to insert user-inputted data through a TableAdapter function in a DataSet. It has worked once but for some reason it stopped working, and I can't figure out why.

Calling the TableAdapter function...
Me.UsersTableAdapter1.AddUser(Me.txtID.Text, Me.txtUsername.Text, Me.txtPassword.Text)

[Code].....

Visual Studio isn't throwing any errors my way or anything so I am not sure what's going on here. The fact that the code worked once but isn't working now is also confusing, and I don't recall making any changes related to this feature since it worked that one time.

View 10 Replies

Parameterizing A NOT IN Statement Not Working

May 5, 2010

Okay, so I have the following code.

[Code]...

Conversion failed when converting the varchar value '17, 18' to data type int. Which is the same error message I get when I run my application. So I guess somewhere along the line, when passing those values in the parameterized query, they are being passed as string literals with quotes around them, instead of integer values separated by commas. How do I add the string that I obtain as the argument for this subprocedure into my sql query's parameter such that they do not get passed as string literals with quotation marks around them?

View 3 Replies

VS 2010 If Statement Not Working?

Jun 27, 2011

I have form1 and form2. On form 2 i have 2 combo boxes where the user is asked to make selections. once back on form1 i try to use those selections as part of an if statement but although i should be triggring them it does not. I cannot figure this out. I have set up test variables and msgboxes along the way to test this.

The code excecutes. I have double checked the variables on form 2. They just do not trigger a response that will enter the if statements even though it looks like they should. I have double checked that test1 and test 2 are grabbing the variables from form 2

test1 is "Male"
test2 is "10 - 19"

When the code excecutes i never get to the msgbox("Age") line of code. I have also tried taking the spaces out of the strings with no luck as well.

[Code]...

View 12 Replies

Working VBS2008, The Use Of The DIM Statement?

Mar 25, 2009

I made a smallprogramm. Each Q is at the top of the Form.vb right under the Public Class.Each A is declared in the Private Sub where the given A is matched with the stored Q. Each A looks like this: DIM Answer1 As String = "Answer" and so on. I would like to use just one DIM statement for all the answers.

View 1 Replies

VS 2005 Working With An OleDbCommand Statement?

Jan 15, 2010

I need some help working with an OleDbCommand Statement existing statement

OleDb.OleDbCommand("Select *, (([AddressDisplay])&', '&([City])) AS Address

The City is stored in database with the city name and an additional abbreviation added. I need to get rid of the abbreviation, if possible.I DONT control the database its from a 3rd party.

Example: Houston[HST] I need to remove the [HST]

Can this be done? Either in the command statement of perhaps in the displaymember of the combobox that reads the database?

View 8 Replies

DB/Reporting :: INSERT INTO Statement Working But Not Saving?

May 19, 2012

I'm running into a slight problem with an SQL INSERT INTO statement. I've tried setting this up first as a command statement and now as a stored procedure. When the process runs it's not signaling any errors and it appears that it's working properly. However when I check the database nothing new has been added. I have the statement within a try catch and it's not catching any errors. I've gone so far as to delete the table and recreate it, still nothing. I should also point out that this entire statement was essentially a copy & paste from another program that's working perfectly.

vb.net code below

Code:
Try
Dim cmd As New SqlCommand
cmd.Connection = con

[code]....

View 1 Replies

Update Statement Is Not Working On Database Software With .mdb

Mar 11, 2010

my simple update statement is not working on my database software with .mdbCompanyDa.Update(CompanyDs, "DisplaycenterData")it works but only in cache, when i restart my application the record is not updated.i solved my problem with some informal steps. i m attaching vb projects zip file, plz open coding for update button and Help me with simple coding.yes one important thing i need help and suggestion for is that in that project and forms are working nice, but with form i m facing problems, specially i cant update new added data/record, it returns error enven i follwed very same coding patterns and formate as i used in other forms in this project, i tried again and again but faild to solve the problem, i also changed table name and fields in database table but it still not working, and coding of other forms is working nice and 's update coding is not working.(update coding for company and book entry form is working and it is not working with purchase5 form, plz help to solve the problem)plz help me with simple coding and removing above mentioned error.to move between all three forms plz click related button at bottom of each form.

View 4 Replies

DB/Reporting :: Error In Inserting - Not Working But Correct Statement

Dec 17, 2008

I keep getting the following error when inserting in to my Access DB using VB.

THe code I use is:

Code:
Dim code As String = "INSERT INTO tblUser(Username, Password, Forename, Surname) VALUES('" + txtrEmail.Text.Trim + "','" + "dfd" + "','" + txtrForename.Value.Trim + "','" + txtrSurname.Value.Trim + "');"

[Code].....

I got the sql code to write in a text box and executed i manually in to Access DB and it works perfectly.

View 12 Replies







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