PlausiblyDamp
Administrators-
Posts
7016 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by PlausiblyDamp
-
Use SQL Enterprise manager - it should have been installed along with SQL. If you can't find it how did you mamange to follow Arch4ngel's instructions?
-
If you wish the user to be able to browse to a file for upload then you will need to use the HTML control - is there a reason why you do not want to do this?
-
Did you follow Arch4ngel's steps exactly? In SQL Enterprise manger under security, Logins you should now have a login for IBM\ASPNET - do you? If so right click on it and bring up the property page - on the first tab is the authentication mode set to windows? (It will be greyed out but you should see it selected) And is Grant Access selected? On the 3rd Tab (Database access) is ther ea tick in the box next to GuestBook? and if so what other roles are selected on the bottom half of the page? Also is the SQL server on your machine or a remote one?
-
What was the original code for the GetString method?
-
Not too sure what you mean by that. Do you require to get an ascii character given it's underlying ascii code - if s othen dim c as char = Convert.ToChar() should do the trick
-
You will need to grant the ASPNET user access to the GuestBook database within SQL.
-
Data Source=IBM;Initial Catalog=GuestBook;Integrated Sucurity=true if that doesn't work could you say exactly what errors you are getting?
-
Did you read the post http://www.xtremedotnettalk.com/showthread.php?t=87821? You are missing your security information - are you using windows or SQL authentication? What is the name of the SQL server, the name of the database?
-
Private Sub RichTextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles RichTextBox1.KeyUp If e.Control = True AndAlso e.KeyCode = Keys.A Then End If End Sub
-
You may find that their own support pages http://forum.itcn.com/forum.aspx will be more help than here.
-
Accessing Directory with password
PlausiblyDamp replied to TripleB's topic in Directory / File IO / Registry
On windows the answer is no, not right away; but he does have the ability to go and grant himself those rights. -
In C# you would declare the interface and class like below public interface ITest //give a better name { void VerifyMethod(); } public class MyControl : System.Windows.Forms.TextBox, ITest { public void VerifyMethod() { // Write the code for the VerifyMethod here } } By implementing the interface you are forced to provide the VerifyMethod and as a consequence anything that implements this interface must have the VerifyMethod. In your form you can loop over all the controls and check which do implement this interface - and if they do call the method like so foreach (Control c in this.Controls) { ITest t = c as ITest; if (t != null) { t.VerifyMethod(); } }
-
you will have to move the code into a seperate method and call that from both constructors.
-
Put the following in either your Sub Main of the Form_Load event of your 1st Form Dim running As Boolean Dim mut As New System.Threading.Mutex(True, Application.ProductName, running) If running = False Then MessageBox.Show("Already running") Me.Close() End If should work fine
-
Worked fine here, but then again you are using Beta software - you've got to expect problems.
-
May be worth having a look here
-
The built in XP firewall is still only a software solution - just like ZA, Kerio, Norton etc. Running two firewalls will not only tie up resources but they will conflict with each other - a Firewall should have exclusive access to the ports it is controlling, two firewalls on the same PC will not both be able share a given port number. If your router has a built in firewall then also running a firewall on the PC is another matter - routers are what is known as an 'edge firewall', they are designed to allow traffic out but block traffic comming in unless configured otherwise. A software firewall on a PC will often allow you block outbound traffic - either by port or application and can help to limit the access a trojan or piece of spyware on your system can actually do.
-
Easiest way is to create an interface that exposes the relevant method and implement that interface in the controls - then you can always do something like 'declare and implement the interface Public Interface ITest 'give a better name Sub RequiredFunction() End Interface Public Class MyControl Inherits TextBox Implements ITest Public Sub RequiredFunction() Implements ITest.RequiredFunction End Sub End Class 'elsewhere you could then do For Each ctl As Control In Me.Controls If TypeOf ctl Is ITest Then Dim ctltest As ITest = DirectCast(ctl, ITest) ctltest.RequiredFunction() End If Next End Sub
-
Are the functions in the dll using the _cdecl calling convention?
-
Not read the article but a quick clicky may shed some light on what you need to do.
-
Only thing I could find was http://filext.com/detaillist.php?extdetail=MSPX
-
I would still only run 1 firewall rather then 2 - if you are using a 3rd party one just disable XP's built in one - it will be a lot more stable, trust me. Like I said attempted hacks are part of being on the internet these days, clicky for some scary statistics on the average time an unprotected PC can expect to survive being connected to the internet.
-
Could have sworn it compiled here but I get the same error :confused: even stranger is that the intellisense generated that code for me :confused: I suppose you are probably best exposing the number of wheels and the minimum number of wheels as properties and do the creation in two stages like you suggest. Alternatively the constructor could throw an error (possibly bad) or simply set the required minimum if the number specified was too low - possibly raise an event to indicate this has happened.
-
You should be able to declare a property as both static and virtual, should work then public class Class1 { public virtual static int MaxWheels { get {return 1;} } } public class Class2 : Class1 { public static override int MaxWheels { get { return base.MaxWheels; } } }
-
Guide to Object Orientated code in .Net This is a continuation of the series started in here and is preceded by this thread Introduction In the previous articles we have looked at a simple class that contains data and functionality. The data is simply stored as variables within the class for simplicity. The functionality of the class is exposed through three routines the Balance property and the Credit / Debit functions, in this article we will look at a bit of terminology and see how we can take advantage of some more .Net features. Class A class is a piece of code that defines the functionality of an aspect of our code, in the previous articles we have a simple class called BankAccount; this defines how a BankAccount works in our system � the data associated with it, the functionality it offers etc. wrapped up into a single logical unit. A class is really just code that it is written to server a particular purpose. A class can be thought of as a new datatype within .Net. Object Whereas a class is the underlying code, an object is an actual running instance of that class. When you declare a variable of your class and then create a new instance of it � the new instance is an object. An object has resources allocated to it, memory, cpu time etc. One class definition can have many running instances simultaneously with each instance maintaining its own separate copy of the variables. e.g. �The following line declares two variables that can hold a BankAccount Dim acc1, acc2 as BankAccount �the following line creates a new instance of BankAccount and �assigns it to acc1 acc1 = new BankAccount() �the following line creates another new instance of BankAccount and �assigns it to acc2 acc2 = new BankAccount() �Credit some money acc1.Credit(100) acc2.Credit(200) �acc1 and acc2 will each have there own value for the Balance property Methods in OO terminology a Method is simply a function, subroutine or procedure (depending on your languages choice of terminology) that is associated with an object. In our case the two Methods are Credit and Debit. A method will have access to all the class� internal variables as well as being able to call other functionality � either from within this class or other classes on the system. Public methods can be called from anywhere within our program � this includes code outside of the class (as can be seen in the form�s button click code), or they can also be declared Private which means they can only be called from within the same class. This gives us the ability to expose a public interface which other code (consumers or users of our class) can call on to access our functionality but still be able to structure re-usable code into reusable methods for the class� internal use. Overloading A feature of .Net (and most OO languages) is the concept of overloading a function, when used correctly this can result in cleaner, more readable code, typesafe code for users of our class. Overloading allows us to declare the same function name more than once within our class providing the parameters differ. In our current BankAccount implementation Credit and Debit both accept a decimal value, this is a perfectly reasonable datatype to use in this case, and if we are using data retrieved from other parts of the system this is probably a good choice. However if we are also dealing with a User Interface (UI) then we are going to be dealing with strings which will have to be converted decimals before we can call the existing methods; also if we are using decimal.Parse we probably want to allow the string to contain currency formatting - something that we may forget if we are having to do this conversion in several places (note the use of Decimal.Parse in both the Credit and Debit button clicks). One possibility is to create an overloaded function that will accept either a string or a decimal value. Public Sub Credit(ByVal amount As Decimal) _Balance += amount End Sub Public Sub Credit(ByVal amount As String) Credit(Decimal.Parse(amount, Globalization.NumberStyles.Currency)) End Sub Notice both method share the same name but different parameter lists � as long as the type or number of parameters are different then this will work; you cannot overload based on return type though., Also note how the overloaded version that expects a string simply converts the data to the correct format and calls the original version anyway, there is no need to duplicate code using cut and paste etc. In calling this function I can now provide either a decimal variable (actually compatible types like Integer and Long will also be accepted) or a string (note it will accept a string containing anything if it doesn�t contain a valid number then a runtime error will occur � this will be addressed in a later article). Any other datatypes will be rejected by the compiler. e.g. Dim acc As New BankAccount Dim s As String = "1,0000" Dim i As Integer = 100 Dim dt As Date = Date.Now Dim d as Decimal = 1.1 acc.Credit(s) 'Compiles acc.Credit(d) �compiles acc.Credit(i) 'compiles (because integers are compatible with decimals) acc.Credit(dt) 'doesn't compile Note how this removes the need for the calling application to always do the datatype conversion but without introducing a multitude of similar function names all serving a similar purpose (any C programmers out there will be familiar with the whole list of functions like atoi, atof, atol � all convert between a string an a number format � atoi: integer, atof: float, atol: long). Shared Members Notice how all the code written so far has required an instance of a class to work with i.e. we have had to declare a variable and set it to a new instance of the class before we can access functionality. Shared members (both methods and variables) do not require an instance and can be accessed direct from the class itself (e.g. MessageBox.Show, all the Math. methods are shared) This can be a useful way of including functionality into a class when you would be inclined to opt for a more traditional modular approach. As an example: our current system allows us to create a bank account and credit / debit it; the ability to transfer money between accounts would be a useful feature for any bank to have � but how do we implement this? We could provide a TransferTo Method or a TransferFrom method which accept another account as a parameter or alternatively look at the following code sample: Public Shared Sub TransferMoney(ByVal accountTo As BankAccount, ByVal accountFrom As BankAccount, ByVal amount As Decimal) accountFrom.Debit(amount) accountTo.Credit(amount) End Sub �This can be called like Dim acc1, acc2 As BankAccount acc1 = New BankAccount acc1.Credit(1000) acc2 = New BankAccount BankAccount.TransferMoney(acc2, acc1, 250) �Note the ClassName.MethodName syntax This provides a method that can be called without an instance of the class but still keeps the code associated with the BankAccount class � again there is a distinct lack of validation etc but this will be rectified in a later article. Playtime Again find attached a sample project containing working implementations of the above code. I suggest running the app and stepping through in a debugger to see the difference in calling an overloaded method and also how the Shared methods work. Next Constructors BankCS.zip BankVB.zip