i changed a class variable to shared so i can access it in all instances of the class, but it caused an error. what is causing this, and how can i fix it?
I want to pass an optional parameter to a function of type System.Drawing.Color. The problem I am having is that when I declare the function it says "Constant expression is required" but I have tried variations of the following, including integers, full qualified indentifiers, even old vbWhite constants to no avail.
In the following code i get a warning at line 59:Warning 1: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.and.. At line 78 I get this Warning:
Warning 2 Property 'SelectedCustomer' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
The program compiles and runs well, but i cant' undesrtand the reason for these warnings. Any Idea ?
1: Public Class Form1 2: 3: 'Form level members 4: Private objCustomers As New ArrayList
I'm trying to make following subroutine work. The problem is this part of the statement.[code]I've tried everything and can't seem to come up with a constant to use here.[code]
I have created a program that creates a blank database in a users account (each user has a seperate folder when registered) by pressing a command button, i have got it to create the database but when i try to populate it with a table to go to the correct folder i get an error
Constant expression is required the code im using for this is: Const strConnection As String = ("Provider=Microsoft.Jet.OLEDB.4.0;" & _
I need to read a named range into an array. Then if the value in the 1st position matches a static value, read the value in the second position. I've been looking into array's and this is what I think will work, however I get a compile error on the columns.count "constant expression required". Is it because in the DIM statement I'm attempting 2 things? This is a macro in Excel. The range name is Data1 and the string comparison is "AnyString". The second value will be an integer.
Sub macro1() Dim rng As Range Dim x As Integer Dim y As Integer rng = Range(Data1) [Code] .....
I want to create a constant of type date and assign it a list of 3 date. How can I assign a list of values to a constant. const dates as date=#1/1/2009#, #5/1/2009#.....
Public Class Beryllium Public Const AtomicNumber As Byte = 4 Public Const Symbol As String = "Be"
[Code]....
I want to make a list out of all the constants (AtomicNumber, Symbol, Name and AtomicMass). I want to make the list also a constant. When I run the code above, I get an error highlighting AtomicNumber (on line on which I commented on "This line"). I tried .ToString() and CStr() but I get errors on both. Maybe there is a different way to make these constants one string or list (must be public and have new lines)?
<DefaultValue(Guid.Empty)> _ Public Property KeyValue() As Guid
I get an error on Guid.Empty "Constant expression is required."
What I'm trying to accomplish is to get rid of this line that shows up in the Designer file,
Me.TestUserControl1.KeyValue = New System.Guid("00000000-0000-0000-0000-000000000000")
I can avoid running the property's Set code with some conditionals on the Value sent when the form instances. I was just wondering if there's a way to deal with it similar to other data types.
When building a class library which contains many classes, all classes uses a lot of common constants and functions, what is the best to do:
1- Declare these constants and functions as public in a module.
2- In each class declare constants and functions used by individual class as private.
The first choice is good for easy and fast implementation, but re-using a class in a different project will require importing the module to the other project.The second choice require a lot of copy/paste for code snippet but a class can be re-used in different project easily.
I am using ODBC to read data from a pervasive PSQL database and in some scenarios, the date column can contain 00/00/0000 date. I don't really care about invalid dates so is there some way I can convert all of these un-representable dates into Null or some specific date instead of the query failing.
EDIT: The following shows the code I am using and where it is failing:
Private _connODBC As OdbcConnection Dim dt As New DataTable _connODBC = New OdbcConnection(txtConnectionString.Text) _connODBC.Open()
I'm trying to create a dynamic html page from vb.net. Here is my code. I get the error "'DataTable' is a type and cannot be used as an expression" ' Create a new XML document.
Dim xmlDoc As XmlDocument = New XmlDocument ' Create the html tag. Dim xmlRoot As XmlElement = xmlDoc.CreateElement("html") xmlDoc.AppendChild(xmlRoot)
This is my window based project since many years ago. I have a public class, and I wanted to have two functions that return 2 different forms that i have in the project.
Below is the code that I'd tried but I got 'FormABC is a type and cannot be used as an expression' error message.
Public Function ShowEForm() As Windows.Forms.Form Return FormABC End Function
'Update' is a type and cannot be used as an expression. I've searched the forums and lowercased letters with no success.
Here is my code:
Dim SupplierContactNum As String = dataList1.DataKeys(e.Item.ItemIndex).ToString Dim SupplierContact As TextBox = CType(e.Item.FindControl("EditSupplierContactTB"), TextBox) Dim TitlePosition As TextBox = CType(e.Item.FindControl("EditPositionTB"), TextBox) Dim SupplierPhone As TextBox = CType(e.Item.FindControl("EditSupplierPhoneTB"), TextBox)
basically i have 16 checkboxes that indicate the status of digital inputs, either checked or unchecked, but rather than adress each and every one of them with a pile of repetative code, i set up a for-next loop and tried to change the status of the checkboxes with - is for index = 0 to 15, if blah=true then checkbox(index) = checked else checkbox(index) = uncheckedBut i get error- checkbox is a type and cannot be used as an expression.
I have some problems with a for loop in visual basic. Public Const numofblocks As Short = 88 Public Shared blocks(numofblocks) As PictureBox For x = 1 To numofblocks blocks((x)) = PictureBox(x) Next The error raised at the picturebox statement: PictureBox' is a type and cannot be used as an expression. The result of this for loop is that every picturebox in the designer form is named: blocks([number of picturebox]). I need this for some other for loops.
I have a project with 7 forms. I wanted to change the startup form for testing, but in the project properties application tab under startup form, only 3 of my forms show up as available. So I manually edited the Application.myapp file and changed the MainForm tag to frmSearch. I checked the property pages and now frmSearch is listed in the dropdown, and it is selected.
Run I compile I get an error: Error 1 'frmSearch' is a type in 'MyTestApp' and cannot be used as an expression. C:Documents and Settings...My ProjectApplication.Designer.vb 35 27 MyTestApp frmSearch is a form, just like other forms that work as the startup form.
I am developing a vb.net application with MS Access Database . I have a field(cut) with double data type in table marks of markss.mdb.[code]On debugging , when I enter ,say 7.9 , in Textbox 1 ,I get an error saying Data type mismatch in criteria expression.