Nerseus
*Experts*-
Posts
2607 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Nerseus
-
Loading a Dataset asynchronously from SQL + VB.NET
Nerseus replied to aah_what's topic in Database / XML / Reporting
You can use a WebService which returns a DataSet. Use the Begin___ and End___ webservice methods to handle the data asyncronously. I don't think you'll be able to do anything with the DataSet until it's completely retrieved though. Meaning, you should call the End___ method in or before Form_Load. If you want a more built-in asynchronous method of getting data, use a DataReader. You can always pump the data into a DataSet as it's retreived if that's what you want. -Ner -
If you really want to add a UI, don't add it to the service. Instead, make it a separate EXE that modifies some configuration file/registry setting. You could have the EXE restart the service, if you're fancy. As for statistics, you could use the performance counters for that (add your own category) or a custom solution such as logging to the Application Log or to a file or database. -Ner
-
There are other third party controls and objects that provide spell checking. In general, I'd imagine any solution is going to involve some kind of looping to check each textbox's contents against some database of words. Using a 3rd party control/object would probably be easiest, but most costly (next to having all your users having Word - unless they already have it). You could also look into using Google's WebServices, which includes a spell checker. I only played around with it and it IS limited (like 1000 or 10000 hits per month or something) unless you pay. Just another thought. -Ner
-
If I understand you correctly, you could set a form level flag such as bMouseIsDown in the MouseDown/MouseUp events. In the MouseDown (of a button, a label or whatever you want) set the flag to true and call some function that loops and does what's needed. Make sure the loop has a call to Application.DoEvents so that you can pick up the window events. You can exit the loop when the variable is false. Is that what you were looking for? -Ner
-
Here is a good book on compilers. It's a VERY non-trival (ie, very difficult) task. Writing an OS, even the simplest one available is 10 times as hard. I'd stick with DOS - surely you can find a copy somewhere? To code in DOS, you might also need an older compiler for C++ or Pascal or whatever - pretty much anything but VB. But at least you'd have access to the disc, monitor, etc. -Ner
-
The object and method calls are identical in VB. You can use the Matches property instead of the Match property to get a list of all matches. Regex regex = new Regex(@"(?<Time>(\d{2}:\d{2}:\d{2}))"); foreach(Match timeMatch in regex.Matches("15-aug-2003 20:03:13 16010630343646 00:05:28 � 0,87")) { string time = timeMatch.Groups["Time"].Value; Debug.WriteLine(time); } -Nerseus
-
Can you run this INSERT in Query Analyzer? Should look something like : insert into burattif.NumeriProva (Numeri) values ('valuehere') Unless your table NumeriProva is owned by user burattif, this might give you an error that the table NumeriProva can't be found. Also, you seem to be freely mixing "&" and "+" to do string concats. Freedom is good but mixing the two styles in the same line of code might not be so good :) (And, I didn't even think that would have compiled since it looks like you're using C# - I thought the "&" string concat operator was for VB). -Nerseus
-
Yes, I see this odd behavior. I'd guess it's a bug in VS 1.0. In VS 2003 (or 1.1 or whatever), it's fixed. -Ner
-
You'll want to look into locking the surface to get at the bits. You'll probably want to look at the backbuffer's surface but depending on how you code things, you may be using a different surface. I wonder why you're choosing DirectX and not just using a fixed width font to make it look "terminal" like? Working with Text seems MUCH easier than DirectX. Heck, even building a real rocketship "McGuyver style" seems easier than using DirectX at times :) -Ner
-
Well if that's what the users have then maybe it's best not to change it, though I might still push to have it either work as "expected" (and that's not just me, that's a Windows standard) or use a different control (such as a Label) to display the value. I see no way of overriding the background and text colors through standard properties. You may have to do it through custom drawing or using the Windows API - sorry, no help on this one though. You might try an alternative such as only filling the combo with the one value that's in it. Along with setting the DropDownStyle to list and maybe handling the DropDown event to close it back up (to make it look like it can't be dropped down), you might get closer to what's currently being used. As a last ditch effort, you *could* use the ActiveX control from the VB project though I wouldn't do that unless you absolutely had to. This assumes the old project was using such a control and that it would in .NET. -Nerseus
-
In addition to JABE's comment (which is the right answer): I'd change your first WHERE to: SELECT * FROM tblworker WHERE priority IS NOT NULL instead of SELECT * FROM tblworker WHERE NOT priority IS NULL It's more readable and it's what's recommended. Also, there's a Database forum where you might get more help than Windows Forms for SQL questions :) -Ner
-
That's a good bit of text and I think I'm hearing two questions. First, how can you abstract the getting of a patient so that calling something like patient.Get(123) get's Patient 123 AND all of his diseases (and whatever support tables are needed). You also want to know what's available to store that data client side? One approach is to use a DataSet. It holds the relationship info for you and you could have the 3 tables needed to map to your relational DB model (if that's what you have). If you create your DataSets through the designer you can have Visual Studio build you what's called a Typed DataSet. That is, it builds a full class structure that maps to your DataTables, exposing them as properties. The columns and rows become collections as well. Very handy :) The other alternative is to build the classes yourself, including any relationships. You have a number of options on how to build the relationships. The easiest might be to have the Patient class contain a Hashtable of Disease objects (of a Disease class). You could use an ArrayList as well - any kind of collection to associate those diseases to a patient. For the record, an n:m relationship is normally called a many to many relationship. What you've described with patiens and diseases isn't a many to many, however (at least not what I'd call a many to many). If designed correctly, there shouldn't be a relationship between patients and diseases directly. Instead, you'd have a Patient Table and a PatientDisease table which contains a DiseaseType key. That's just standard relational db structure. It sounds like the diseases in your sample aren't really a "real" datatable, not something that changes very often and isn't really part of a transaction. Rather, it's a lookup table (or standard values table) which contains the Disease code and a description. The "real" data table is the child table off of Patient, maybe a PatientDisease table. In the past, I've only come across the need for a many to many in a few, rare instances. Right now, for instance, I have a Plate table (a plate that goes on your car), and a Validation Sticker table. They're both "real" tables - neither is a lookup table. We have the need to put stickers on different plates (not at the same time of course :)) so we need a link table - the many to many table - which contains nothing but 3 values: the Identity column, the Plate ID and the Validation Sticker ID. (Ok, there are a few more columns in there, but they're not important for this.) -Ner
-
You add DLLs references through your project's References. In the solution explorer, you right click References and click Add. Locate the DLL and select it. Now that namespace and any classes in it can be instantiated (well, public ones and such). You can also put all the projects together in one solution. If you have one project open, you can right click the solution node (the topmost entry in the solution explorer) and click Add. You can then add a new project or an existing one. Once added, go to the references and click add but this time click on the Project tab - it will show all the projects in the current solution. Now that namespace and any classes in it can be instantiated (well, public ones and such). -Nerseus
-
Well for syntax, you can check the MSDN library. For APIs, I use google (but you must know the exact API name). As a rule of thumb, it's a good idea to keep a little code repository for yourself. It could be a bunch of txt files, a bunch of small projects (what I generally do), or a custom tool that stores code snippets and lets you organize them and search them. It will be invaluable as you learn more and more coding tips. I guestimate that once you have about 50 tips packed away in your head you start losing one for about every 10 new ones you pick up. -Nerseus
-
Have you ever coded anything before? Are you very advanced? You'll either want a 3rd party control to help you, or you'll be coding a bunch of GIF headers by hand. That is very technical stuff and unless you're a pretty good programmer I wouldn't suggest even trying. -Nerseus
-
You can define matches in the regular expression and pull them out using the Matches property. A group has the syntax: (?<Time> ... ) Where the ... is the regular expression, such as: (?<Time>(\d{2}:\d{2}:\d{2}) Regex regex = new Regex("(?<Time>(\d{2}:\d{2}:\d{2})"); Match match = regex.Match("15-aug-2003 20:03:13 16010630343646 00:05:28 � 0,87"); if(match.Success) { string time = match.Groups["Time"].Value; } -Ner
-
Creating a service isn't that hard. There's a template for creating them, I believe that makes it pretty easy. If I remember right, you just hook to the three or four events (start, stop, etc.). If the program needs to continually run, it's probably better as a service. Generally, services have NO visual interface. Since it's being started by a username that may not currently be logged on, how would you expect the currently logged on user to view anything? The same would be true for a scheduled task - it's really a matter of should you have ANY interface at all. I'd guess probably not. -Ner
-
Is this a dynamically enabled/disabled control? If it's never enabled, why use a combobox at all? If it toggles, I'd think you'd want it to look disabled to give the user a visual cue that it can't be changed. Otherwise, if I see a combobox with an enabled look but it doesn't dropdown, I'm going to report it as a bug! (Better not let me be one of your testers!) -Ner
-
A PNG file (like a BMP but a different format) can contain not only the red, green and blue values of every pixel but can also contain an alpha value for each pixel. If drawn using the alpha channel, it allows a blending of the pixel in the PNG file with whatever is currently on the screen. So if the top pixel has an rgb value of 255,0,0 (pure red) and an alpha of 128 and the pixel on the screen where the pixel in the bitmap will be drawn is white, you'll end up with a pink dot. Alpha values go from 0 to 255. If it's 0, there is nothing new drawn to the screen from the bitmap. If it's 255, the pixel in the bitmap is drawn, overwriting whatever was on the screen. Any value in between is a blending of the two pixel colors. In the above, 128 is 50% blending - so blend the pure red with the pure white and you get pink. -Nerseus
-
Check out Bucky's response in this thread. Once you know how to load a bitmap from your EXE, you can expose a static method in a class in your DLL that let's you pull out the filename dynamically. If you need help with that, let me know. -Ner
-
You will have a separate column in your DataTable and set it's type to string (in your case) and set the Expression property to something like: ds.Tables[0].Columns[0].Expression = "brNum + '-' + brName"; If the brNum or brName fields might be null you can wrap them with IsNull(brNum, '') to convert to empty string. Check out the expression property in the help for Visual Studio. There is a LOT of stuff you can do with them. There's one weird problem with expressions. If you happen to define your DataSets using XSDs and the XSD has an expression column, the expression may not contain any data after you first call dataAdapter.Fill(). What we've seen is that setting the expression to itself will fix this, so in the above use something like: ds.Tables[0].Columns[0].Expression = ds.Tables[0].Columns[0].Expression; -Ner
-
You can mix them in separate projects, not within the same project. Each project would be a separate DLL (Class Library project type) and use it's own language. The main EXE could also be whatever .NET language you wanted. -Ner
-
You're searching for APIs, FOR Loops and more... but nothing specific? It sounds like you might want a website that shows tutorials and guides for beginners? The forums are more for problems or issues that people need help with (with the exception of the Tutors Corner and the Code Library forums). Check out the various FAQs at the top of the forums. -Ner
-
You can use the task scheduler. You go to C:\Windows\Tasks and click "Add Scheduled Task". You select the EXE (or BAT file or whatever you want) and pick the run time (When My Computer Starts). For that option you specify the userid/password for it to run as. You could also create a service instead of the EXE but the above would work just as well for most cases. -Ner
-
You can't create an animated jpg, only an animated GIF. I would strongly suggest NOT trying to code this yourself unless you're a very good programmer. It would require building a GIF file by hand which means understanding the headers involved and how the bytes of the data work for the image. You might be able to find a control that helps you with some of this. But, if you really just want to create an animated gif and not write a program that does it, I'd suggest finding a utility to do it. I use Paint Shop Pro's Animation Studio (last copy I bought was around $80 for both PSP and the Animation Studio). I'd bet a dollar there are some free animated gif builders available if you search google. They normally work by having you add a bunch of individual gif files and then tweaking the speed of each frame and a few other parameters. -Ner