.net - Asp.net Code Returns A Blank String
Jul 28, 2011Anyone know why the following is not working?
[Code]...
I get no errors, it just returns a blank string.
Anyone know why the following is not working?
[Code]...
I get no errors, it just returns a blank string.
I have to create a block of code that detects the Local IP address of connected adapter and returns it as string to a TextBox.
View 7 RepliesI'm trying to sort an array based on a structure but whenever I do this, it basically erases all the data in the entire array.I have verified that the array is populated correctly, it is when using array.sort that everything returns blank.
View 6 RepliesI've always been slightly stumped as to why the following happens if I write[code]...
View 4 Repliesjust found out that replace(string does not do the same as string.replace when my string variable was an empty str the first one returns "nothing" and the second returns an empty string (as expected).just sloppy coding anyhow, it was a function that was converted from classic asp and never rewritten properly. [code]
View 1 RepliesOn a data grid view there is a blank row with a (*) in it that allows the user to insert a new row of data.Is there a way to put focus on that row using code even though the data grid view has many rows already loaded in it?
View 1 RepliesI'm doing some experimenting with getting a print output that I like. I incorporated some code I was offered as solution on this forum. I was so proud of myself until the great formated text on the form engages the printer to print a BLANK PAGE? Why do I get Blank?ow:
Imports System.Drawing.Printing
Public Class Form1
Public drawString As String
[code].....
I am trying to create an application for a wire company that sells spools of wire for $100 each. The normal delivery charge is $10 per spool. Rush delivery costs $15 per spool. The user should enter the number of spools ordered in a text box, and check Rush Delivery box if rush delivery is desired. When the Calculate Total button is clicked, an input box should appear asking the user to enter the number of spools currently in stock. If the user has ordered more spools than are in stock, a portion of the order is back-ordered. For example, if the user orders 200 spools and there are only 150 spools in stock, then 150 spools are ready to ship and 50 spools are back-ordered.
Attached is the code with comments on what each function is supposed to do. I dont know why but the form always returns zero.
'Declare variables
Public intNumberofSpools As Integer
Public intBackOrder As Integer
[CODE]....
How can we remove all blank spaces from end of the string fox example the string name before remove space
View 6 RepliesI have a string which contains many rows of data which has been converted from a datatable. The last row of my string has nothing within it, no spaces or anything. How can I get rid of this row? I have tried regex, but cant seem to get anything that does the job. I am writing in VB.[code]...
View 2 RepliesIn this example, an error is raised if either row.FirstName or row.LastName are NULL.
How do I rewrite the Select clause, to convert a DBNull value to a blank string ""?
Dim query = From row As myDataSet.myDataRow in myDataSet.Tables("MyData") _
Select row.FirstName, row.LastName
NOTE: Since the DataSet is strongly-typed. I can use row.isFirstNameNull(), but IIF(row.isFirstNameNull(), "", row.FirstName) will not work since all parameters are referenced.
I'm a new member to this site, and I have been searching for a solution to this problem.. Although I have found variations in the problem, nothing has seemed to work for me. Just started programming last year.
I am trying to populate text boxes in a form based on information from an Access Database. Everything is working, except when there are empty field values; the program then crashes because a DBNull value is returned. I set up an if statement to check the index as the rows are read for DBNull values, the problem is How do I actually change the value in the field from DBNull to a blank string ("") ?? Everything I try gives me an error, most often saying something about setting up an object. The problem happens within my if statement of the do loop...I'm thinking maybe I need to set up parameters ? Or an actual edit session within a datarow variable?[code]...
I have problem insert records from my vb application to my access .mdb dataabse with all columns set as not allow zero length string and when I insert a records in which one of the column is null value it show allow zero length string error any idea how to create a code in visual basic in which allow zero length without change the configuration of the database?
For example my record have job_no name station 1 des 2 albert so I need to pass job number 1 to my access database but came out with error zero length string off course my access database is set no all to do so but I have my reason is that any sample code to force to accept blank strings?
I'm implementing a feature which reads comma separated txt file from server(one line at a time). Format of file is fixed, There are 3 columns on each row. After reading the row from file I insert it in a database table. But first value of each row aoutomatically appends two blank spaces, even if there are no blank spaces at the begining of each row. I tried to use "TRIM/LTRIM/Replace" to remove blank spece from the first value of each row, but didn't succeed.
[Code]...
I am trying to format a Function Code so that it returns a 4 digit result no matter the entry by the user (i.e. they enter 540, stores 0540 in the database). While looking online, I've found the format function, but when I use it, it returns 540, regardless if I enter 540 or 0540. [Code]
View 2 RepliesMy Requirment is to Leave Blank space to the right of the each Lable (String) in Chart in SSRS.
Using Custom VB.NET Function, i want to Pass String Lable to VB.NET Function and then Function Return String with Padding Blank Space to the right of String.
Example :Lable String is : "United States of America"
My Lable output should be : "United States of America "
How can we achieve ?
Let me know if you need mor information.
is there any other way to achieve this ?
i have a small program to run through a log file and extract data from it which works, but the array it puts out has a blank value before and after the actual data values, and it confuses me why that happens, i dont really understand why and was hoping someone here knew! the parts of the code related are below
Dim rgxSessionStart As New Regex("^Session Start: [A-Z][a-z][a-z] ([A-Z][a-z][a-z]) (dd) dd:dd:dd (dddd)")
Dim substrings() As String
substrings = rgxSessionStart.Split(LineIn)
a sample line that it would match is Session Start: Sun Aug 22 00:00:00 2010 which WORKS, but the values of the array are "","Aug","22","2010","". so its not a critical problem because i can still get the data from it, but those blank values are puzzling and i feel like maybe im doing something wrong with the syntax or method for them to be there.
I am chasing a strange error at a customer site and was wondering if it is possible that Environment.MachineName could return a zero length string. The docs say this is read from the registry but doesn't specify where. I can't imagine that a machine cannot have a netbios name but just wanted to ask.
EDIT
After some investigation, it appears that this was not returning a zero length string, but I was just interested if it is feasible.
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias _
"GetPrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Integer, ByVal lpFileName As String) As Integer
Dim value As String = ""
Dim length As Integer
Dim IniFileName As String
GetPrivateProfileString("Config", "UserName", "None", value, length, IniFileName)
but value contains an empty string I confes to being a VB n00b, less than a week, in fact, but I can't see what's wrong there. The file exists, it contains a section called "Config" which has an entry called "UserName" with a value - but even if not, wouldn't value take the default?
Edit: It's not returning an empty string - it's returning whatever I initialize value to before calling GetPrivateProfileString().
Which is to say that if I Dim value As String = "xxx" then it stil contains "xxx" after the call and not the default value.
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias _
"GetPrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
[code].....
I'm converting a system of numerous programs from foxpro/foxweb/javascript to asp.net/vb/sql server.
I'm coding for a dropdownlist which is currently controlled via js.
I don't like using the control this particular way, but I want to maintain look and feel for the customer.
The control is initialized with some values via Page_Load() in behind code.[code]...
[Code]...
By my logic, this should only assign .length to index IF the length of strItem is longer than 0. This check is there in case the listbox is empty, or the user has not selected an item. However, everytime I go through this code without an item selected I get:
[Code]...
I'm trying to updatesome records, currently my table is blank apart from the user id which is correct. but i get the error below.
My UserSettings table is as follows
ID is a Integer
MonthID is a Integer
YearID is a Integer
UserName is a string
Balance is a Integer
PhotoAddress is a string
GameSpeed is a Integer
This is my code and below that is my error in my ErrorTXT box.
[CODE]...........................
my app is calling a dll that returns SQL details to a bufferred string, here is what i did 6 Dim server As New String(" ", 256) when i use this in sql connection string i get this error: Format of the initialization string does not conform to specification starting at index 22.
View 10 Repliesis string.empty = "" why the fallowing function returns 0
vb.net
Dim String1 As String = String.Empty
Dim StringEmpty As String = ""
MessageBox.Show(String.Compare(String1, StringEmpty, False))
I use an OLEDB connection to read from an excel database, and this loop to read in all of the data from each of the columns
While reader.Read()
For i As Integer = 0 To reader.FieldCount - 1
temp = reader(i).ToString + ControlChars.Tab
output_file.Write(temp)
[code]....
Some of the columns contain date information, which are read in fine (usually as a string "2/20/2011" or so), but the headers of those columns are read in as a blank "". The headers for all the other columns read in fine, but not for the date containing columns.
I get an empty string when calling the .Text property. Refer below for snippet:[code]The internet search advises to use Items(col).Cells(2).FindControl(..), the problem with that is FindControl finds the control by ID, BoundColumn doesn't allow you to insert an ID for it.
View 1 RepliesHaveing troubles with an assignment. I am writting code that will allow user to enter a score and the program returns a grade based on the score entered. I can get it to work using "IF" statements but want to use code for ranges. My "IF" code is as follows.......
[Code]....
I am currently working on a custom data type, and wanted to implement a = operator.
I data type is a nullable date that returns a string value if date was supplied.
I want to allow the variable to be set like this
Dim nd as New NullableDate nd = Today Does anyone know how this can be done, or can anyone point me in the right direction?
I'm strugling the whole day with the next JSON string
{
"0":{"link":"afbeeldingenplaatje1.jpg"},
"1":{"link":"afbeeldingenplaatje2.jpg"},
"2":{"link":"afbeeldingenplaatje3.jpg"}
}
How can i deserialize this? What's wrong with the next code (vb.net)
Public Class DataString
Private m_link As String
Public Property link() As String
Get
[CODE]...
It returns always an empty result.