Extend Activity Class And PreferenceActivity Class At Same Time?
Apr 8, 2011I want to have my main class for creating activity for 2 different flags.
1) One with relative layout Textview and images for which I am extending my class as[code]...
I want to have my main class for creating activity for 2 different flags.
1) One with relative layout Textview and images for which I am extending my class as[code]...
I have a couple of bits of code I add to a textbox in my codebehind on form.If I wanted to extend this class or somehow create a shared instance of this code so I can pass in the parameters for text to display in textbox and use in any of my forms.. [code]
View 1 Repliesi've tried to extend on the default class size, but couldn't do so. example
[Code]...
why is it that there is no such thing as size when im sure that i could create a new size(x, y)
is there any way to extend upon a procedure itself?like i want to be able to do the following
Code:
public sub test()
msgbox(special())
end sub and it should popup a string, let's say "cool", plus i shld be able to use special() in every single sub but if we call special() from a function it should be rejected. how can that be done?
also, we should also be able to do the following
Code:
public sub test()
msgbox(specialvariable)
end sub whereby specialvariable is accessible by every sub.
In order to organize various methods of my MainForm class, I would like to categorize them into several files. Of course, the methods would still need to access form elements and additional variables I added in the MainForm class.
View 3 RepliesThis has got to be one of the most frustrating issues with asp.net. I first got the error parser error cannot load default and as I have done before checked if the naming was correct in th bin folder and made the changes accordingly. Now I get the following error:
somethiing._DEfault is not allowed here because it does not extend class 'System.Web.UI.Page'
where something is the name of the project in the properties. I have the following code in Default:
Namespace FormDiscovery
Partial Class _Default
Inherits System.Web.UI.Page
Shared settings As New System.Configuration.AppSettingsReader
[Code].....
Now I have deleted the project and other in the solution and created a new one and still this error and if I take the 'something' name away I get the cannot load default error.
I'm writing a .NET CF (VBNET 2008 3.5 SP1) application, which has one master form, and it dynamically loads specific UserControls based on menu click, in a sort of framework idea. There are certain methods and properties these controls all need to work within the app. Right now I am doing this as an Interface, but this is aggravating as all get up, because some of the methods are optional, and yet I MUST implement them by the nature of interfaces.
[Code]...
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 RepliesI 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 RepliesI 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?
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 RepliesI can't make difference between public class and private class and friend and protected friend class.
View 1 RepliesI can do this without problem.
Class A
End Class
Class B : Inherit A
End Class
Dim Obj1 As A = New B
so I used to mess around with C#, just a little. And someone had helped me make a class for Visual C# that was supposed to do the math parts for "internal structure" - which the program used for a part of its calculations and screen... Basically there were 2 options. Endo-Steel and Standard. The user would use a updownbox to determine weight of the machine and then internal structure was a % of that total. If it was standard then it was 10% of the overall weight, if it was Endo-Steel then it was 50% of standard (so 5% of total weight) rounded to next 0.5 (so .25 was .5, 1.25 was 1.5, 1.75 was 2.0, etc). I have the code for the C# class file for it, but want to make it in VB.
[Code]...
The trouble with the UDPClient class in .NET Microsoft, in its infinite wisdom, built this class in .NET as a simplified method for UDP communication. The one critical thing they forgot to include was a simple time-out feature.What's wrong with not having a time-out? Plenty, if you have one end of the transmission expecting to receive data, and the source of the transmission decided to go belly-up. If you use the UDPClient.Receive method, and the application sending the message does not send the message, then that UDPClient.Receive method will block forever--at least until the application is closed by the user.
A rather nasty way of handling such a situation. By the very nature of UDP, packets can get lost and never be received, causing the application to wait forever, or a bug in the sending application may simply cause it to never send the message that is expected.
Why on earth Microsoft did not put a time-out feature in this class is beyond me. What this means is that if you are doing any real programming you'll find the UDPClient class to be hopelessly inadequate. You'll have to instead use the more generic Socket Class to accomplish your task.
Below is a code sample that uses the Socket Class to accomplish the tasks that the UDPClient is meant to do, but with a timeout.The UDPClient Class is for synchronized data transmission. If you are trying to do asynchronized transmission, you would have had to use the Socket class, anyhow.
Code:Imports System.Net.Sockets
Protected Shared Function UDPDataTransmit( _ ByVal sBuff() As Byte, ByRef rBuff() As Byte, _ ByVal IP As String, ByVal Port As Integer) As Integer 'Returns # bytes received Dim retstat As Integer Dim Sck As Sockets.Socket Dim Due As DateTime Dim Encrp As IPEndPoint Try Sck = New Socket(AddressFamily.InterNetwork, SocketType.Dgram,
[code]....
The maximum value that works for AutoPopDelay property of ToolTip is 30 seconds (30000 milliseconds). Any values greater than this maximum will be defaulted to 5 seconds (5000 milliseconds).[url]...
How to set to extend the duration show time for ToolTip? or alway show until the mouse leave the control?
How to extend the session time. There are many form in my application like parent and child forms. So how can I make pop up to appear when session times out and the pop up should appear on the form where the user is currently in, when popup comes I have to disable all forms like(they should be transparent (i.e) user should NOT be able to edit them).
View 2 RepliesWe have a project for a client that is written in VB.NET. In one of the projects, we have about 100 modules, which are all VERY simple. They're extension methods that convert between object types. Here is a small snippet:
Public Module ScheduleExtensions
<System.Runtime.CompilerServices.Extension()> _
Public Function ToServicesData(ByVal source As Schedule) As ScheduleServicesData
[code].....
I'm having trouble with a Stopwatch one one of the user's machines. I'm using the Stopwatch class to track time elapsed on one of my applications, and it seems to work fine on everyone else's machine, but on one machine it goes really slow. It's probably 1/3 or 1/4 of the actual time elapsed.
Here's the
I'm using the timer to update the textbox that displays the time elapsed of the stopwatch every second.
Partial Public Class
Private WithEvents breakTimer As New Timer
Private breakSW As New Stopwatch
[Code]....
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]...
I've been creating short test apps repeatedly to try to understand some of the concepts in VB.NET.For the most part it has been illuminating.I read Bucky's .NET knowlegebase tutorial on passing objects as parameters to newly created forms. He shows how to create a new class that inherits from the base form class and define a New() method with parameters Extending the concept I thought about doing the same thing with a form that was created at design-time (In this case Form2).
[Code]...
Example:
Two files - TestClass.vb, myForm.vb
TestClass.vb looks as follows:
Imports System.Threading
Public Class TestClass
Private myClassThread As New Thread(AddressOf StartMyClassThread)
[code]....
The result:Application runs, no errors or exceptions.Displayed is the listbox and the Start button.I press the start button and a msgbox says "Not Invoked" as expected and upon clicking OK to that msgbox "Start Button Pressed" is added to the Output listbox control.Immediately following that the msgbox pops up again and says "Not Invoked". I was expecting "Invoked" as a separate thread is trying to use the Output listbox control.Of course this results in the Output.Items.Add being attempted which results in no visible result as the thread is not allowed to directly update the UI control.
I have some classes, BsfciFile and StudyFlashCard. Bsfci is the extension to which I save my set of flashcards in an INI format. I am currently working to transform my code from using Windows API calls to access the INI to using a IniFile class that I found on the internet. I would like the BsfciFile to have a Array of StudyFlashCard objects, but I would like the StudyFlashCard class to use the IniFile class object contained in the BsfciFile class. I can pass the IniFile from the BsfciFile class to the constructor for the StudyFlashCard class, but I want it to modify the same IniFile as the BsfciFile class has later on.
[Code]...
I have a class that is stored after serialization and compression.Is there any event built in the class that is fired automatically when a class is deserialized and ready to be used??
View 1 RepliesBase class has one field to hold numeric balance value. With 2 methods that accept arguments for adding and subtracting the new input calculating new balance. Sub class has four fields dates, transaction, memo and amount.I have a deposit form, and withdraw form. Each time one transaction is entered it creates an object with sub class fields, then adds to the account collection. My problem is not understanding how to call the deposit/withdraw method and pass the current transaction amount back to the base class to alculate the new balance. Does anyone have any links to information/tutorials on how to perform something like this? As you can see with my code I have tried various different approaches without any success.
[Code]...
Create a class named Service. Inside the Service class, declare a class variable named Started. The datatype of this variable is Boolean.Public Class Service Dim started as Boolean End Class Create a class named Server. Inside the Server class, declare a dynamic array that can contain elements of the type Service.(Note: For convenience, both the array and the variable Started can be accessible from a client program that creates an instance of Server and Service respectively)
Create a constructor for the Service class. When the constructor is executed, it will set the value of the class variable Started to True. Create two new classes: WebServer and DatabaseEngine. Both of these classes inherit from the class Service. Inside the Service class, declare a Sub procedure (method) named Terminate. This method should display the following text Service stopping in a message box when executed.This method can be overridden in classes that inherit from Service class.
Inside both the WebServer and DatabaseEngine class, override the method Terminate inherited from their base class Service. Both methods should first call the base class Terminate method. The messages Web server stopping and Database engine stopping should also be displayed in a message box when the Terminate method for the WebServer and DatabaseEngine are called respectively. These messages should only be displayed if the Started variable inherited from their base class is not equal to False.
Inside the Server class, declare a method named Shutdown. This method does not return any value. When executed, it will call the Terminate method for each of the Service instances (if any) in the arrServices
array. You should call the Terminate method within a For Each loop that loops through the elements of the arrServices array.
In the Sub Main method, create an instance of the class Server. Set the size of the arrServices array in
your Server instance to contain 2 elements. Create first a WebServer instance and then a DatabaseEngine
instance into this array. Call the Shutdown method from your Server instance.
I want to created a nested class that can only be visible to and instantiated from the parent class.But I also want to be able to use an instance of the nested class through a public variable of the parent class.I tried making the nested class private, or making the nested class' constructor private, but it won't compile.Is it possible to do this in .NET?
[Code]...
I want to read a number of items from a file and then associate each of those items with a new button at run-time, so that when the user clicks one of the buttons I can display some information about that item.Can I use a LIST to manage these buttons and items? Can I create a new class and have each list item of that class, such as 'btnID', 'btnText', etc... ?
View 2 RepliesE.g. I have a class:
Namespace Common
Public Class AClass
Public Class BClass
[code]....
How can I use BClass without saying AClass.BClass, I've see some existing code using this format, but I can't find the setting.
I'm making a custom class that mocks the System.Drawing.Rectangle class because the Rectangle class doesn't have a name property. I need a name property because I am adding all of my rectangles to a collection and I need a little more info stored than just their locale and size. So I changed the _onPaint event but nothing is working out when I run the program?
Public Class Rectanglar : Inherits UserControl
Public BackgroundColor As Color = Color.Blue
Public Sub New(ByVal name As String, ByVal XY As Point, ByVal Widthy As Integer, ByVal Heighty As Integer)
[code].....