Jump to content
Xtreme .Net Talk

Denaes

Avatar/Signature
  • Posts

    975
  • Joined

  • Last visited

Everything posted by Denaes

  1. My code was like so: private frmCustomers as frmCustomers Public Sub Customers() With frmCustomers If frmCustomers Is Nothing Then frmCustomers = New frmCustomers End If .Show() .Activate() End With End Sub The whole point was that I couldn't have multiple instances of frmCustomers open at once. I ONLY ever want one open. If there is one instantiated, then .Show it. If there isn't, then instantiate it and then .Show it. It worked fine, then I realized I had Option Strict Turned off. I turned it on and dealt with the 900 new errors that popped up in my task manager. This one didn't. I was fully unaware until I went to open the form today that it wouldn't work. I changed the code to this: Public Sub Customers() If frmCustomers Is Nothing Then frmCustomers = New frmCustomers End If With frmCustomers .Show() .Activate() End With End Sub Subtle difference, the "with frmCustomers" will never occur before it's instantiated, which was flipping the compiler out, but not showing up as an error in the IDE. Really made no difference in what I wanted to acheive. But now I have a new problem. I can open the form up once, but once I .Close it, it disposes the form and refuses to let me .Show it again. I can't do this in the code: Public Sub Customers() dim frmCustomers as frmCustomers If frmCustomers Is Nothing Then frmCustomers = New frmCustomers End If With frmCustomers .Show() .Activate() End With End Sub Because that defeats the whole purpose and allows multiple instances of the form to be open at once. I've been able to rig it to nearly work (enough to keep developing on) like so: Public Sub Customers() If frmCustomers Is Nothing Then frmCustomers = New frmCustomers frmCustomers.Show() End If With frmCustomers .Visible = True .Activate() End With End Sub In the form code, I changed Me.Close to Me.Visible = False. In this procedure, I changed it to only .Show when a New instance is created, and otherwise just make sure that it's visible and activated. Yeah, if you close it with the X in the upper right corner, I get the error about it being disposed of. I know this was long, but this shouldn't be anything hard to do. It should be a pretty standard feature to not want multiple windows floating around. The only other semi-solution I can think of is to make the windows .ShowDialog(), but I want people to be able to see multiple windows at once. It helps to see a booking and customer screen at once.
  2. hmm, even better. I already had vb.net standard, I was doing it for a second copy. When I went for the final verification I was given the choice of TWO products, not just vb.net standard 2003. I chose: A Developer Welcome Pack (containing a training CD and Application Architecture book) It was an option if you already had vb.net standard and didn't want another copy. True to word, its 100% (monitarily) free. It cost only your time to watch 5 5 minute videos, and rate them (maybe taking it up to 7 minutes a video, so 35 minutes total) No shipping costs (though 4-6 weeks) were asked for.
  3. http://msdn.microsoft.com/vbasic/atthemovies/ if you're in the US or Canada, you can get a free copy of VB.Net standard by watching videos and giving feedback. Nevermind you just might learn loads of new things by watching the videos. My only gripe is that the videos seem to be hosted rather than .wmv or .avi/.mpg. You don't seem to be able to download them, so you have to take notes or expect to go back and download the movie again.
  4. They need to choose a range of times. A StartTime and an EndTime, so it's unavoidable that they don't select the times. It shouldn't be any complication other than having a time picker pop up and let people choose what time they want. In theory I could make it a string and validate it into time format for display in the properties and convert it to date within the program. But I think there should be a way to do it using only date. I wish date were broken down into Date and Time. If there was a Time data type, it would be so much easier in some cases, especially like this where the date means nothing, but the time (and all of the time functions like adding/subtracting time units) is the real meat you're working with.
  5. I'm doing this program thats way too many forms (well, only like 15) and I want to make it more modular. Most of the forms are pretty standalone. They all access the same database via the same dataclass I created, which uses datatables to transmit the majority of the information. Really, there are only a handful of variables that need to be accessed across the forms (loginID and securityRank, then mostly colours and custom settings), other than that, everything is pretty standalone. I wanted to make each form (or in one case pair of forms) into standalone .dlls that conform to an interface. Then to test them out I can just drop the .dll in the directly and select it off of the list. Mostly I'm using Divils Plug-In tutorial, but it deals with regular classes, not forms. What I need to know is probobly very easy, just how to get a form(s) into a .dll.
  6. I feel like burning the book now. I glanced at how to write a property, wrote it like that with "Value", looked in the book and saw it wanted you to do the "_mandatory = Mandatory". Figured it was something unique to Properties or something. Then again the book also had an error were _manditoryColor was defined as an array (dim _mandatoryColor() as Color), which I had to change. Just sounds like poorly tested code or bad editing... not very promising when you're trying to learn from a book and errors are popping up. Thank you :)
  7. I'm customizing a control for future use and I need to pass two time values to it as properties. I thought setting them as Date would work, but from the properties window, only a callandar pops up. I'm sure I can set the time via code, but I want to make it be able to be set in the properties window. Any suggestions?
  8. This is mostly testing the waters for me to learn how to improve and finally create my own control components. I had this working fine (it's an example in my Mastering VB.Net book) a few months ago, but I just came back to it and I can't get it working correctly. In the TestApp I created to run it, I can see the properties in the code view and set them without any errors. I can also open the properties window and everything looks fine. But when I double click on the Mandatory property to click False to True, it doesn't work. When I click on one of the color, it lets me choose a color, it remembers it if I open up the color chooser again, but the little color box stays white unless I change the backcolor manually. When running the TestApp, even setting the colors via code, it just assumes that the EnterFocusColor and LostFocusColor are both white, even if I set something else. If anyone can see a mistake in my code, I'd be appreciative :) Imports System.ComponentModel Public Class TestText Inherits System.Windows.Forms.TextBox #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'UserControl1 overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() ' 'UserControl1 ' Me.Name = "UserControl1" End Sub #End Region Dim _mandatory As Boolean Dim _enterFocusColor, _leaveFocusColor As Color Dim _mandatoryColor As Color #Region "Properties" <Description("Indicates whether the control can be left blank"), _ Category("Appearance")> _ Property Mandatory() As Boolean Get Mandatory = _mandatory End Get Set(ByVal Value As Boolean) _mandatory = Mandatory End Set End Property <Description("Indicates the backcolor when control has focus"), _ Category("Appearance")> _ Property EnterFocusColor() As Color Get EnterFocusColor = _enterFocusColor End Get Set(ByVal Value As Color) _enterFocusColor = EnterFocusColor End Set End Property <Description("Indicates the backcolor when control looses focus"), _ Category("Appearance")> _ Property LeaveFocusColor() As Color Get LeaveFocusColor = _leaveFocusColor End Get Set(ByVal Value As Color) _leaveFocusColor = LeaveFocusColor End Set End Property <Description("Indicates the backcolor when left empty an is indicated as mandatory"), _ Category("Appearance")> _ Property MandatoryColor() As Color Get MandatoryColor = _mandatoryColor End Get Set(ByVal Value As Color) _mandatoryColor = MandatoryColor End Set End Property #End Region Private Sub TestText_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Enter Me.BackColor = _enterFocusColor End Sub Private Sub TestText_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MouseLeave If Trim(Me.Text).Length = 0 And _mandatory Then Me.BackColor = _mandatoryColor Else Me.BackColor = _leaveFocusColor End If End Sub End Class
  9. Oh, like those infuriating programs that refuse to move were you want them to move or do what you want them to because they're constantly docking or moving where they want to... If it's not a standard feature (it's standard to dock a control on a form in that fashion), it wouldn't be a hard procedure to write. This would be MUCH MUCH easier than actually docking forms on each other, like I thought you wanted :D
  10. You mean you want to create a method on one form and make it accessable on another? It would have to be a public sub/function and I believe the form you want to run it off of would have to be instantiated (formX = new formX). Generally if you have something you want accessable across forms, it's best to create a class for both forms to access. Then again after having a form's code raging upward of 2000 lines of code, you quickly learn to love encapsulating code in classes :)
  11. Yes there is. Do I understand how? No way in hell :D But the Master of winforms, Divil does and has a component for it on his site here: http://www.divil.co.uk/net/ as well as numerous tutorials and documents.
  12. Thanks. Certainly gave me someplace to start. Is this Singleton in the Design Patterns Book? I need to pick that one up. This is what I found for vb.net and Singleton Desing Pattern: Imports System.Threading Public Class Singleton Private Shared _singleton As Singleton Private Shared _mu As New Mutex() Private Sub New() End Sub Public Shared Function GetInstance() As Singleton _mu.WaitOne() Try If _singleton Is Nothing Then _singleton = New Singleton() End If Finally _mu.ReleaseMutex() End Try Return _singleton End Function End Class The page just basicly had this and an explaination that this was one of the (potentially) most powerful design patterns and would only allow one instantiation of a class. How would one use this class? I'd think there would be a function that allows you to pass a type in, or do you have to create this type of class (or inherit it) for every single form?
  13. I've got a main screen which allows you to select and open any number of 8 forms. I need to make it so that only ONE form can be opened at a time. The problem is that if I include the "frmCustomer = new CustomerForm" inside of the procedure (for button, menu item, etc), it allows multiple instances to be created. Is it bad form (no pun inteded :D) to declare each of the forms in your Form's public declarations, then instantiate them all once in your form load event, leaving them instantiated and ready to run? If I do this, I find that a simle: .Show & .Activate seem to be perfectly suitable to show a form or bring it to the front if it's already shown.
  14. Yeah, my mistake. I misread what you wrote. I thought you wrote that my INNER JOIN was wrong, but should be LEFT INNER JOIN. You wrote LEFT OUTER JOIN. I should stick my nose out of things I don't understand really. I thought he just ment "Join" and was trying to help. Sorry :(
  15. You can generally write however you like, but to write double quotes, I think you need to use the asci keycode or the .net/vb keycode (which is probobly just a wrapped asci keycode). I've never really seen the huge todo about needing special methods of reading/writing input, unless you're going to share it with another program. Personally I use XML becuase it's the easiest, but I've used plain text and just thought up a method on the fly for writing/reading. You just need to figure a way to seperate what is the "Name" of the property, and what is the data within. In your case, it's the text on a line up to the quotation mark that is telling the program what the setting is, then after the quote and until the next one is the setting. It's really easy to create a class to read/write in this fashion and keep it generic enough to use in all your apps.
  16. What's the difference between LEFT INNER JOIN and INNER JOIN?
  17. Do you have MS Access? Without trying to sidestep, that is by far the easiest way to learn these things. You make your query in design view and right click and choose SQL. MSDE probobly wouldn't have these features, but SQL Server XXXX better damn well have them for that price! Here is what I got from access for a two table showing One to Many: SELECT FROM <OneTable> INNER JOIN <ManyTable> ON <OneTable.Key> = <ManyTable.ForeignKey>; Hope that helps a little.
  18. You'll have to throw the timer down on your form and set it to check like every minute, 10 minutes, hour, etc. Then do a time check: Date.Compare(Time1, Time2) if time1 is greater, 1 is returned. If time2, then -1 is returned. date.now.toshorttimestring will get you the current time.
  19. I know that when you're inside of a procedure and make declarations, their scope is only within that procedure (sub or function or class). I've seen mention of calling dispose to get rid of some instances of variables when unneeded, but do all variables need to be disposed in this manor? If I call a sub, once that sub is over, won't it (eventually) collect all the resources from that sub? What sorts of things should you dispose of, anything that involved New?
  20. I was thinking about it. I have a program written in delphi which uses up 720kb of ram. My .Net rewrite of it uses 20megs of ram. I'll chalk up half of that to my not being memory concious and trying to get it working before fine tuning it. My program starts up as 10mb of ram, then jumps to 20, but doesn't really get much higher.... maybe a meg or two. But I also chalk some of that up to the .Net framework having to JIT compile it, then in order to keep it compiled, it hangs out in ram. Why so much memory for such a tiny application? My thought is that .Net isn't a native process to XP/2000/ME/98. Its running another application (the framework/JIT compiler) just to run whatever it is you're running. Plus the framework does something about managing it's own memory, which is something else running. Well on these machines, its an extra service to run. On Longhorn, thats going to be the native service all the time. The .Net memory manager would always be running, as would the JIT and other .Net features. I think they'd be optimized because, on Longhorn at least, they wouldn't be acting as an interpreter to another OS (XP, 98, etc). They'd be the native process. I'd think .Net apps would take up less memory in that case because it's just the memory associated with the App, not the framework (thats already covered by system resources). Also they should run faster, while the older apps that use the old API's would be running piggyback on the OS instead of being built in, and running slower. This should make .Net apps run faster, while older/other apps run slower (might not notice with those blazing fast CPU speeds) and take up more memory. I think this would cause a higher demand for .Net apps as well. Now its a hassle to install the framework. Yes, I had VPs complain about it because they bought .Net instead of VB6 (which I had asked for at the time) and had to install 20mb packages on 200 machines to run my 200kb programs!! :D Or the world could give MS the middle finger at, yet again, messing with their computing experience in the name of progress.
  21. It's a gradual thing. It doesn't go from nothing to 100% Also the AVI problem is caused because XP is defaulted to scan all media (and other known files) in a directory to give you information about them. Yeah, I do have directories with avi files in them. I don't know if this is the total solution though. Personally XP brings very little that I find usefull. Working with my laptops dual monitor video card, media navigation controls (sound, chapter search, etc built into the laptops body) and being able to turn the stupid touch pad off are welcome additions. being forced to scan my external hard drive (which does contain avi's) and USB memory sticks every time I put them in and ask me if I want to play everything EVERY TIME is NOT welcome and actually makes me feel violated and intruded on. I shouldn't have to click cancel 3 times whenever I insert a disk or external hard drive. I also dislike many of these scanning the folders and giving previews for everything "features". I'll find out if this is the problem. MS aknowledged the problem a few years ago and said it would be fixed with SP1 (which is the XP Home edition I do have straight off the disk), but I do have this issue and I remember having this issue at times at work on their XP machines. Doesn't happen at all if I just program or go on the internet, but whenever games, directory browsing, searches, installing things (possibly with avi media), soon after XP wigs out. So far it's been a few hours and no problems :)
  22. Try to do as much as you can, then ask as specific questions as you can. Honestly I did this because I read the post, then realized I needed to create a setting file for my app. So I did this for my app to hold settings.
  23. I don't have a (known) virus. I googled it and it turns out to be a fairly common problem. There are numerous threads on numerous message boards dedicated to solving this problem, which go back into 2002 and 2003, so it's not a new thing. I found what could be a solution here: http://www.tweakxp.com/display.aspx?id=841 I tried it, I'll see if it works.
×
×
  • Create New...