Attributes.Add("class", "className") But Preserve Existing Class?
Nov 1, 2011
Simple thing, well, I think it is.I need to Add a class to an element within an asp:repeater under certain conditions, using VB.
So, I can do
ITEMID.Attributes.Add("class", "classToAdd")
But this removes the existing classes and therefore screws up my CSS.
[code].....
View 2 Replies
ADVERTISEMENT
Mar 1, 2010
I need to create unit testing project for my current website. The currentw ebsite si written in VB. All unit testing examples are using interface to create mock object. My current VB class does not implment any interface. Can I add interface and implement it to my current class and functions without affecting or changing codes to any pages in my website that call the functions? For examples my current class is like:
[Code]...
View 2 Replies
Jun 4, 2011
I have two forms that are called by the main form. One is named frmEdit, and is invoked by the ShowDialog (modal) method. The other is named frmSearch and is invoked by the Show (non modal) method. In both cases I want to preserve the last window position so each form (class) begins with Public Class frmEdit (or frmSearch):
Dim lastx as Integer = -1
Dim lasty as Integer = -1
in the Shown event handler for each form I have the code
If lastx >= 0 Then
Me.Left = lastx
Me.Top = lasty
End If
and in the FormClosing handler I do
lastx = Me.Left
lasty = Me.Top
What I don't understand is why the frmEdit (modal) form remembers its previous position but the frmSearch (non-modal) does not. frmSearch always invokes with lastx and lasty equal to -1.
View 5 Replies
Mar 30, 2010
I have been learning about OOP and classes from a book and one of the question is the book has asked to create a simple Saving/Checking accounts Program. The question says that most of the functionality must be done through an Accounts Class, and this Acoounts class must inherit certain private fileds from an base class 'Transaction.
The question also says that data from the Saving/Checking accounts Program must be read to and from a text file, and these functions must be done within the Acounts class.
i have done everything the question asks to the best of my knowlegde and understanding but when it comes to storing and retieving data from the textfile i cannot utilise the array i created to store the textfile data onto it.
Bank Account.Write a program to maintain a person's Savings and Checking accounts. The program should keep track of and display the balances in both accounts, and maintain a list of transactions (deposits, withdrawals, fund transfers, and check clearings) separately for each account. The two lists of transactions should be stored in sequential files so that they will persist between program sessions.
Consider the form in Figure 11.12. The two dropdown combo boxes should each contain the items Checking and Savings. Each of the four group boxes corresponds to a type of transaction. (When Savings is selected in the Account combo box, the Check group box should disappear.) The user makes a transaction by typing data into the text boxes of a group box and pressing the button. The items appearing in the Transactions list box should correspond to the type of account that has been selected. The caption of the second label in the Transfer group box should toggle between "to Checking" and "to Savings" depending on the item selected in the "Transfer from" combo box. If a transaction cannot be carried out, a message (such as "Insufficient funds") should be displayed.
The program should use two classes, Transaction and Account. The class Transaction should have properties for transaction name, amount, date, and whether it is a credit (deposit) or debit (withdrawal/check). The class Account, which will have both a checking account and a savings account as instances, should use an array of Transaction objects. In addition, it should have properties for name (Checking or Savings) and balance. It should have methods to carry out a transaction (if possible), to display the list of transactions, and to load and retrieve the set of transactions into or from a sequential file. The events InsufficientFunds and TransactionCommitted should be triggered at appropriate times.
Hint: In order for an Account object to display a list of transactions, a list box should be passed to a method as an argument. The method might be declared with Sub EnumerateTransactions(ByVal lb As ListBox).
Here is my code. I am sorry this code is basic and unedited.
Public Class Form3
'load contents of Text file into the listbox when first loaded
'store data in file into array of accounts, record no. counts
[code]....
View 3 Replies
Jan 10, 2010
We can add class in class diagram and voila the code show up. What about the other way around. Say we already have a class. Can we add that to class diagrams?
View 3 Replies
May 30, 2012
Is this possible to use <Attributes> on a method in a Class extension ?Here is a Class A
Public Class Goblin
Inherits Monster
Enum goblinsRole
[code].....
View 1 Replies
Oct 7, 2011
Python has a setattr to set public attributes for any class on the fly.
So, how to do that with VB.net ?
[Code]...
View 2 Replies
Sep 1, 2009
How can we apply attributes to class fucntion using AOP in C#?I am slightly not clear in what context AOP should be used? As we can use AOP for logging purpose, security(Authentication), please suggest some other scenarios where we can take benefit of AOP.Is AOP can be use to share data among different running threads in application process?
View 2 Replies
May 29, 2012
I want to invoke a method on a class that i have a reference to. The method that I want to call has a custom attributes. Currently I can find this attributes and call the property of my class Attribute.
is there a way to invoke that method ?
PS/ The project is written in vbnet, but I think the solution is the same in c#.
View 1 Replies
Mar 11, 2009
I'm just curious why class/property attributes in VB.NET have a weird optional syntax such as:
<TestAttr("a", "abc", Optional1:="foo", Optional2:=3)>
VB.NET allows you to set optional parameters like this to avoid order restrictions (which is lovely) but in this case it's forcing you to that.For example this is not possible:
<TestAttr("a", "abc", "foo", 3)>
even though the parameters are in the same order as the original definition.
View 2 Replies
Oct 27, 2011
Given the following class
[Code]...
How can I read the custom attibutes of the CustomerID or any other property?
View 1 Replies
Sep 27, 2011
I have an API that I created and currently utilize successfully in C#. I am trying to create an example of interacting with the API in VB.NET (so that the QA without C# experience can still utilize it for creating automated tests).
In C# I do the following
[TestingForm(FormName= "Land Lines", CaseType= _caseType
, Application= ApplicationNameCodes.WinRDECode, HasActions= true)]
public class LandLines : RDEMainForm
[Code]....
This gives me a compile time error because it claims that FORM_NAME and CASE_TYPE is not defined, even though the class has it defined inside.
How can I use the defined constants inside the class in the class attributes?
View 1 Replies
Jan 4, 2011
I am trying to retrieve the Attributes of a class's property specifically. So for example. Let's say I have a class called "Employee", and a custom attribute called CustomLabelAttribute with a string value. What would I need to do to retrieve the value of CustomLabelAttribute for Employee.FirstName specifically? I assume I will need to use reflection, but it's kind of new to me, and I've just recently started using it on any level.
[Code]....
View 3 Replies
Feb 27, 2009
I have a class called Player in the business layer of my web application.Player class has fields PlayerID, CategoryID and CountryIDA function in Player Class calls a function in PlayerDB Class in the Data Access Layer which in turn calls a stored proc which returns data for PlayerID, CategoryID (foreign key to Category table) and CountryID(foreign key to Country table) from the Player table.I now have a situation where I want to add Country Name and Country Image (url path) to the above call, returning the new fields from the Country table for each CountryID.My question is, do I add the country name and country image as additional fields to the Player class or do I have new classes called Country(BLL) and CountryDB(DAL) and a new stored proc?
View 5 Replies
Dec 16, 2009
If Class X is within the scope of Class Y, is X a subclass of Y?If Class A is a sub Class of B, then is Class B considered a super class of A?if Class C inherits Class D is Class D a superclass or parent of Class C?if Class E extends Class F then we can consider Class E a child of F?if Class G inherits Class H and is within the scope of Class I then who is the parent of Class G? Classes that inherits Class J and classes that are within Class J are all sub classes of Class J?
View 1 Replies
Apr 15, 2010
I have put this code in the global form Inherits System.Windows.Forms.Form. And then in the form that will inherit this from the global Inherits MenuStrip. "MenuStrip" is what the global form is called. But keep getting this error: Error1Base class 'MenuStrip' specified for class 'Lesson2' cannot be different from the base class 'System.Windows.Forms.Form' of one of its other partial types.
View 5 Replies
Jun 27, 2009
I found what i was looking for on this old thread but I don't know exactly what to do woth it. The code given by Tall Dude seems to compile fine except for two errors..
[Code]...
View 2 Replies
Jul 22, 2011
I have a class (see below)
Imports Microsoft.VisualBasic
Imports System.Data.SqlClient
Public Class ClientProfile
#Region "Variables"
[CODE]...
It is in the file ClientProfile I have placed in both App_Code and also App_Code/Models
In my code behind I have the following
[CODE]...
The last word, "ClientProfile" has the scary squiggly red line below it. It is not recognizing my class.Even the Intellisense is not picking up te class. Do I have to register the class file in any way?
View 4 Replies
Sep 24, 2010
Suppose that I want to implement another method for a class namely hasFiles for System.IO.Directory , How can I do that?
for example if I add <Extension()> _ tag before each function or Sub I can add a new function or method for each Control.
View 3 Replies
May 30, 2010
I still can't understand classes in VB.net and I fell myself like a child.. I have found on MSDN example:Almoust everything is clearly, but DataGridView1 is created in this code in programm. If I have already DataGridView1 that created in designer - how can I override it events and ground it on other class?
View 4 Replies
Jun 30, 2011
I want to open an existing VB class file, add a few properties and close it again.
Simple enough, I thought: Take the CodeDom, a VBCodeProvider, parse the code (using the Parse-method), then identify the location where I want my stuff added (doubtless using some nifty LINQ expressions), add a bit of code and then have it generated and here we go.
Now I see that Microsoft apparently added the Parse method only for the fun of it but never implemented it.
What's the story here? Can I only generate code from scratch? Is it not possible to load existing code?
View 1 Replies
Mar 18, 2010
I have a VB.NET solution (call it S1) which produces a .vb file (say File1.vb) to be compiled and then included in another solution (S2). S2 is a console app which I want to run from a cmd prompt, not VS. My plan is to shell out from S1 to run a batch file to do the compile and then copy the .dll file, overwriting the old one in S2 (then I can run S2 in a separate operation). Here's the batch file for the compile:
View 4 Replies
May 8, 2009
I have written a method to replace multiple characters in a string. Is it possible to overload my own method to the existing method "Replace" in the String namespace?
Function Replace(ByVal inValue As String, ByVal ParamArray replacechars() As String) As String
For i As Integer = 0 To UBound(replacechars) Step 2
[Code].....
As you can see it have a different signature from the public method so I think it would be nice to have my method overloading the existing method
I can live with it if it isn't possible. See it as a "nice to have"
View 2 Replies
Apr 14, 2009
Relating to another question I asked yesterday with regards to logging I was introduced to TraceListeners which I'd never come across before and sorely wish I had. I can't count the amount of times I've written loggers needlessly to do this and nobody had ever pointed this out or asked my why I didn't use the built in tools. This leads me to wonder what other features I've overlooked and written into my applications needlessly because of features of .NET that I'm unaware of.
Does anyone else have features of .NET that would've completely changed the way they wrote applications or components of their applications had they only known that .NET already had a built in means of supporting it?
It would be handy if other developers posted scenarios where they frequently come across components or blocks of code that are completely needless in hindsight had the original developer only known of a built in .NET component - such as the TraceListeners that I previously noted.
This doesn't necessarily include newly added features of 3.5 per se, but could if pertinent to the scenario.
Edit - As per previous comments, I'm not really interested in the "Hidden Features" of the language which I agree have been documented before - I'm looking for often overlooked framework components that through my own (or the original developer's) ignorance have written/rewritten their own components/classes/methods needlessly.
View 5 Replies
Jul 27, 2010
link that implements DES algorithm with CBC. if I want to use an existing class to implement the standard DES (using ECB) to encrypt file, how do i do? I want to use this class because it implements each step of the algorithm.
View 4 Replies
Sep 27, 2011
Is there any way to add new properties to a control? For example, I'm using an "OvalShape" from Microsoft's Powerpacks, these are designated as "Cells". I would like to add properties to the class itself (if I had a physical class to edit) for different processes such as "energy level", "family number", "mutation", etc. General variables that are either Boolean, Integers, or etc. If there isn't a way to edit the powerpack class itself, is there a way I can use the ovalshape power pack in my own class and add extra properties to it myself?
View 3 Replies
Apr 17, 2010
if I have several of these movable PictureBoxes added to a Form (Form1) and want to display a selection rectangle only on that PictureBox, that is just selected,then I think I should use a flag to mark whether a PictureBox is selected or not. The flag could be used in paint event to decide,whether the selection rectangle is to be drawn or no .To add a flag property to the new class is no problem. But how can I set the flags in all other existing instances of the class, when it is set to True in the selected PictureBox?
View 1 Replies
Sep 11, 2009
Dim a as Type=GetType(className) would gimme the type. But I have only the name of the class as string. I want something like GetType("class1") which would return the type.
View 2 Replies
Nov 10, 2010
I have two user controls that need to add a class atribute to the body tag of my page, however they currently over write one another if I just use Body.Attributes.Add("class","value") So I need to check if the class attribute exsists and if it already contains the value Im going to add.
If Not Body.Attributes("class").Contains("value") Then Body.Attributes.add("class", Body.Attributes("class") + " " + "value") End If
EDIT: The contain constraint doesnt return the expected value, resulting the the class not been concatinated, Example: add class "dog" then I a different instance of the same control tries to add "dog" but the contains("dog") returns false
View 1 Replies
May 15, 2009
I can't make difference between public class and private class and friend and protected friend class.
View 1 Replies