Jump to content
Xtreme .Net Talk

dakota97

Avatar/Signature
  • Posts

    116
  • Joined

  • Last visited

Everything posted by dakota97

  1. Hi Al,, I have a query that returns a set of results with 7 records as seen below. What I'm looking to do is to combine those 7 records into one record. The only differences are the values in "Value X" field. http://cgdesign.net/images/sql.jpg Thanks in advance, -Chris
  2. As always you've come through again. I went into the file system viewer and set the properties of the configuration files to "Vital = false" and the installer no longer runs each time. Once again, thank you. -Chris
  3. Hi all, It's been a while since I've posted here, but I haven't forgotten all of you, and I'm back with another strange issue. I'm using VS2008 and I've created a standard deployment project for my app. I've created a custom installer class to override the standard one simply to delete a configuration file based on the user's selection during the install. This way I can have one package to deploy both version of the program, and the user selection determines which version is installed. Simple enough right? The problem is that each time the application is started, the Windows Installer appears and "re-installs" the application. This in turn puts both configuration files back in the application directory. It appears that my customer installer is run during this process, but since there is no selection, it doesn't delete either of the 2 files. So, in short, why is the installer running each time the application is started? Any ideas would be greatly appreciated. My code for the custom installer is as follows: public override void Install(IDictionary stateSaver) { string installedVersion = Context.Parameters["Selection"]; string installDirectory = Path.GetDirectoryName(Context.Parameters["assemblypath"]); //Delete the appropriate configuration file if (installedVersion == "Standard") { if (File.Exists(installDirectory + "\\Configuration.xml")) File.Delete(installDirectory + "\\Configuration.xml"); } else if (installedVersion == "Network") { if (File.Exists(installDirectory + "\\Config.xml")) File.Delete(installDirectory + "\\Config.xml"); } } Thanks in advance, -Chris
  4. Hi all, Is it possible to create a new .jpg file from 2 colors that a user selects in a WinForms app? What I want to do is give the user an option to select 2 colors using a colorpicker. When they click "save", I want to create a new 1px wide by 1050px high gradient style image to be used as a webpage background, and save it so that it can be uploaded to a web server via FTP. The uploading I can handle, but I need to know if there's a way to create the image file. Thanks in advance, -Chris
  5. Hi all, I have a database backup application that I wrote that connects to a remote SQL instance and copies all database changes to my local SQL Server instance. Everything is working fine, with one small glitch that does cause a problem if I need to restore the database on the remote server. In short, the app connects to the remote database and retrieves a list off all databases on the server. It then connects to my local server and retrieves the same list. It compares the list and creates the database on the local server if need be. During this process it also creates the tables, and then populates the corresponding records. It does this for each database it finds until all databases have been processed. The problem that I have is that when it creates the tables it doesn't set the identity property for a specific column that is set as the primary key, int, identity, etc. If I use query analyzer to generate a script of the table, I can see that the identity column is indeed specified. However, in my code I use the following line to retrieve the table structure, but it doesn't include an identity property: SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'myTable' Does anyone have an idea on how I can make this happen? It work be really nice if there is a way to programmatically script a table the same way it does in QA, save the script as a text file locally, and then run the script in code when I create the table. Is this possible? Thanks in advance, Chris
  6. Well, I finally figured out what is was. I had a second <form> tag on my page that for some reason was resetting the original text value of all textboxes on the page. Anyone have any idea why this happens? I'd really be interested in an explanation.
  7. Unless there's something funky going on that I don't know about, the answer is no. That's why it's throwing me off as to what the problems is. Here's my Page_Load code: protected void Page_Load(object sender, EventArgs e) { if (Session["LBSRegistering"] == null) { Session.Add("LBSRegistering", "1"); } //Determine if the user has previously logged in if (Session["LBSUsername"] != null) { txtUsername.Visible = false; txtPassword.Visible = false; Label4.Visible = false; Label3.Text = "Welcome back " + Session["LBSUsername"].ToString() + "!"; btnLogin.Text = "Logout"; } if (!Page.IsPostBack) { //Load the site sponsors LoadSiteSponsors(); //Update the AJAX controls UpdateStats(); UpdateBanner(); UpdateListings(); UpdateEndingSoon(); tmrUpdateBanner.Enabled = true; tmrUpdateListings.Enabled = true; tmrUpdateStats.Enabled = true; ScriptManager1.RegisterAsyncPostBackControl(tmrUpdateStats); ScriptManager1.RegisterAsyncPostBackControl(tmrUpdateBanner); ScriptManager1.RegisterAsyncPostBackControl(tmrUpdateListings); } } None of the update methods do anything with the textboxes either. They simply load data into UpdatePanels from the database. Temporaily I've done a workaround just so I can keep moving forward. I'm doing HTML form-style passing, but I've lost my page validation functionality by doing that which isn't a good thing. Any suggestions? -Chris
  8. Hi All, I'm running into a very annoying problem, and cannot for the life of me figure it out. I have 2 web pages that I'm working with in a registration process, Register.aspx and ProcessRegistration.aspx. The first page has 2 textboxes for existing users to login at the top, and a registration form for a new user to fill out. However, when I fill out the registration form and submit it, the page does not keep the form data so that it can be processed. At first I tried processing the data in the click event of the submit button on the Register.aspx page. If the information was correctly processed, then it sent the user to a success page. But, I believe that I was running into a problem with the postback for that page. It is my understanding that what was happening was the page was re-initializing the controls, and that's why the text boxes has no text values. So I tried looking at cross-page posting by sending the data to the ProcessRegistration.aspx page, but am still having no luck. Can anyone give me some advice on how I need to do this? This is a big project for a client, and I'm totally stuck on this, and it's a major part of the application. Any help would be greatly appreciated. Thanks in advance, Chris
  9. Sorry about not getting back to you sooner. Had a family emergency over the weekend. To give you a little background, I'm creating a web application for a local high school booster club. I've converted all of their existing static HTML pages to ASP.Net using C#. I then wrote a small "updater" application that the user enters the website changes into, which in turn inserts the data into a SQL database. The reason I need 2 copies is because my client wants to be able to preview any changes to the site prior to posting them live. So, I created 2 seperate folders on the web server, one called "portal" and the other "preview". I basically duplicated the site files in both folders, and created the corresponding tables in the database. When changes are made, the data is inserted into the "preview" tables, and once they approve them, the records are then copied into the live database tables, deleted from the preview tables, and published on the site. This method might not be the best, but it was what I came up with given the limited amount of time that I had to complete the project (football season is now started). So, what my thoughts are is to create a webservice that is called from the application after the user uploads a picture to the server. It would then find and copy the original file into the appropriate location, ultimately having 2 copies of the image on 2 different difrectories. Since the web server is obviously more powerful than the local machine, I figured it shouldn't take as much time to copy the file from one directory to another, as opposed to uploading the file via FTP a second time to the second location. Web space isn't a concern, but I figured that after the changes were approved, then I could delete the "preview" image from the directory. Any thoughts? -Chris
  10. Hi all, It's been a while, but I'm back with another question. This time its dealing with files on my web server. I have an application that uses FTP to transfer files from a local computer to my web server. The file needs to be copied into 2 different directories. The only problem is I don't want to have to upload the file twice through the local application. Is it possible to create a web service on the server that is called from the app that will copy the newly uploaded file from one directory on the server to another? Or, is there some kind of automated task that I can create that will monitor one folder and, if it sees a new file, copy it to the second folder? Any suggestions will be greatly appreciated. Thanks in advance, -Chris
  11. Hi All, My current web hosting provider does not allow me to assign a subfolder as an application directory for ASP.Net web apps. I have to contact their tech support and have them set the folder that I specify as a web application folder in IIS from their side. They use H-Sphere as their control panel, but their current version doesn't allow user-side changes like this. They have mentioned to me that I could do this through Visual Studio when I publish the app, but I've never come across anything that gives the option of creating a web application folder during the publish procedure. Is this possible, and if so how? It's an inconvenience to have to get ahold of tech support each time I want to create a different folder, and make sure that it's set correctly so that the web app works. Thanks in advance, Chris
  12. Hi all, I'm writing a C# app that will print information from a database. I have a pre-printed form that I need to print on and align the data so that it fits in the pre-defined areas. What is the easiest way to do this? Does anyone possibly have any examples that they can point me to? I really don't want to take out a ruler and manually enter all of the spacing, etc. Any help would be appreciated. Thanks in advance, Chris
  13. Hi all, Anytime I've needed answers to questions, you guys haven't failed me yet, so here it goes. I am developing an app that requires a high precision timer. I need something with the resolution that QueryPerformanceCounter provides, but I am finding that Intel SpeedStep, AMD Cool and Quiet, Dual Core, and just bad motherboards are causing QPC to return unexpected delta values. I have seen in a couple of different threads that using /usepmtimer will cause Windows to use the ACPI timer. Is this the best way to go? 1) For what operating systems will the /usepmtimer switch work in boot.ini? (2000? Dependant on XP service pack? Dependant on num CPUs?) 2) Will the /usepmtimer switch work with non-intel CPUs? 3) Does using the /usepmtimer switch mean that QueryPerformanceFrequency will always use the ACPI timer and return 3579545? 4) Is there an API or assembly to read the ACPI timer directly w/o needing to use the /usepmtimer switch? 5) Has anyone ever seen a case where QPF will change? I have tried SpeedSwitch XP and laptops with no A/C attached and can�t get it to do so. 6) Has anyone ever seen a case where QPF doesn�t change but acts as an order of magnitude difference? I have an end user who has a new Dual Core Dell and when they specify 1800 milliseconds for a duration value, it actually acts as 18000 (18 seconds). 7) Will XP SP3 when released fix some of the QPC/QPF anomalies? 8) I am aware there is a hotfix for dual core systems, what does it actually technically do? If anyone can answer any or all of these questions, or point me in the right direction, I would greatly appreciate it. Thanks, Chris
  14. Thanks Machaira for the reply, and sample. I had a problem opening the solution file, saying that it was missing 3 files. But, I was able to successfully convert you VB code into C# and get the sample working. The only problem I see (and it was probably my fault for not being more clear in my explanation) is that when drilling down through the tree, it places the "HKEY_LOCAL_MACHINE/Software/E-Prime......." as a string value at the lowest level. What I'm looking to do is parse that string, and build the tree according to the values. I guess a better way to explain it would be I need to retrieve that string from the "RegistryKey" node. Then I need to insert the "HKEY_LOCAL_MACHINE" as the first node in the treeview. Then add the "Software" as a childnode to that...."E-Prime" as a child nose to "Software"...etc. Then, I'll need to grab the next "RegistryKey" value, and do the same, only without duplicating the childnodes. So somehow I need to check and see if the childnode already exists (which I can see that you code does do), and if it does go to the next part of the string. Thanks for the effort, and if that explains it any better, let me know any ideas or suggestions. Thanks, Chris
  15. Hi all, I'm having problems building the hierarchy of a treeview control from an XML file. I'm basically looking to replicate the same structure that the Windows registry uses (HKEY_Local_Machine/Software/....etc.), but I can't figure out how to build the tree so that I don't duplicate childnodes. Our tech support team receives XML files with various infomormation retrieved from the end-user's computer. They use this to diagnose hardware compatibility issues with our software, since a lot of it is low-level communication with the hardware. However, it is painstakingly time consuming to read the raw XML that is produced. So, I've been assigned the task of creating a "Support Reader" application that will load the XML file into a "human readable" format. Ultimately, the application will parse the XML file, and create the tree structure. Then when the user clicks on a specific node, the underlying values will be populated in a listbox or listview control, the same way as seen when navigating through the Windows registry. So far, I've been able to insert the top-level nodes (all the HKEY ones), and one childnode, but I'm having major difficulties adding additional nodes below that. The big thing is that if the node exists, I don't want to add it a second time. I've attached the XML file template that I'm using, and would appreciate any pointers or code samples on how I can get this to work. Thanks in advance, Chris machineinfo.zip
  16. Hi all, Well, I'm back at it again working on the 2nd version of my Point-of-Sale program. For those of you who helped me on the first version (you know who you are), I just want to say that I couldn't have done it without you. Everyone here has been great, and I have really learned so much by just being here. For those of you who haven't yet seen it, or just want to check it out, you can download it here . Feedback would appreciated. So, I've received hundreds of emails from customers requesting different features, and i'm trying to incorporate as many as possible into the new version. One feature that I'm working on is the option of sending daily sales reports via email to a user-entered email address. What I thought about doing was create a small Windows service that generates and sends the report every night at a specified time. My questions are: 1.) Can I install the service through the deployment project for the main app? 2.) How do I start the service once it's installed? 3.) Is there a better way to do this instead of creating a Windows service? Any feedback would be greatly appreciated (as always). Thanks in advance, Chris
  17. Crystal Reports for .Net Programming To answer your first question, if you have the entire Visual Studio suite, and not just a stand-alone language (i.e. VB.Net standard, etc.), both 2003 and 2005 do come with Crystal Reports for .Net built-in. The only thing you need to do before you deploy your app is to register your copy of CR.Net, which is totally free. To answer your second question, I strongly recommend purchasing Brian Bischof's book "Crystal Reports for .Net Programming". For approx. $30, you will not find a better book than that to help you understand CR. I bought it when I first got into CR, and some of the pages have actually fallen out of the book as much as I've used it. You can visit the website at http://www.crystalreportsbook.com, and click on the "Purchase" link at the top to find resellers. The first half of the book he describes creating a report graphically using the IDE. The second half he explains how to create them programmatically, giving code examples for VB.Net, C#, and ASP.Net languages. I never quite dove into it far enough to create a report entirely in code, but I did create the report layout in the IDE, and then did everything else in code (i.e. instantiate, load, login to DB, print, etc.). My advice...buy the book. It will save you so much time and headache trying to figure things out for yourself. He even describes step-by-step the entire process to package up and deploy your report. That section alone is worth it's weight in gold, as there are definitely a number of steps that need to be taken for everything to work (i.e. merge modules, license key, etc.). Chris
  18. Stored Proc?...Trigger?...Other? Hi all, I have a project that I'm working on that involves a SQL database with multiple tables that are all linked to a general Users table. The Users table includes an Identity field as the primary key. The other tables use this field as an identifier for the user that the record is associated with. What method should I use so that if one of our apps inserts a record into a table, the "user information" is added to the Users table first, and then the Identity field is copied and combined with the rest of the information, and inserted into the original table? I'm vaguely familiar with stored procedures and triggers, but I have never used either one of them as of yet. Any suggestions/examples/tutorials would be greatly appreciated. Thanks in advance, Chris
  19. I ran into a similar problem when I was teaching myself CR.Net, and the best decision I made was to purchase Brian Bischof's book "Crystal Reports .Net Programming". You can check it out at http://www.crystalreportsbook.com . There is a "Purchase" link at the top of the site for stores that carry it. The first 1/2 of the book explains everything from start to finish on graphically creating a report. The second 1/2 explains everything about creating a report programmatically using VB.Net, and includes relative code samples for C# and ASP.Net as well. This book saved my life when I was trying to figure out how to create a receipt and various reports for my point-of-sale program. I HIGHLY recommend buying this book. In the meantime, I'll scan through my old code and see if I can't pull up a few examples on how I generated my reports and post them for you. Check out that site, and seriously consider buying the book. You won't regret it. Chris
  20. Hi all, Is there a way that you can allow you a form to connect to multiple database types by creating a separate database class in C#? What I'm aiming to do is create a data class that has the connection information for both an OleDb and SQL database connection. I want to be able to allow a form to connect to the appropriate database type based on the information that is included in the data class. For example, I have 2 separate projects in my solution. The first project is my Windows Application. The second is a class library. My library includes a data class, and in the data class I have a public string property that returns the type of database that is being used. Then, I would like the form to have the ability to open the correct type of connection to the database, based on the value that is returned from the property. My main reason for this is due to the fact that later on, if I decide to change the database type, I could edit the data class, and send out an updated class library without having to go through and package up the entire application. Any suggestions would be appreciated. Thanks in advance, Chris
  21. First off, thanks for the replies. All 3 of you have given good examples and ideas. After looking at it, I think the plug-in example is the way that I want to go with this. I'm going to take a look at the examples in more depth later on tonight, and I'll get back to everyone on the outcome. Again, thanks for the suggestions. Chris
  22. I understand your code, and it would work great. Only one problem. The forms are not previously declared, therefore I cannot create a collection to loop through. The program has now knowledge of what forms exist. Let me try to explain things a little better. Overall, I'm trying to make the program as modular as possible so that future updates are easier for me. The entire menu system is generated dynamically by reading entries in my database. From there, each menuitem's click event points to the OpenForm method in my first post. What I want to be able to do in the future is create a new form, add a menu item to the database, pacakge everything up and send it out as an update. I have a completed version of the program that I wrote in VB.Net, and I am now going through and converting all of the code to C#. Originally, since this project was a learning project, any updates that I made included modifying the existing code, and then packaging up the entire program once again and distributing it. Since the setup files are approximately 8.5mb, this isn't a very efficient approach. I've spoken with a couple people, and the topic of late binding has come up. I'm not really sure how that works, but I'm assuming that is what I need to do in order to get this to work properly. Can anyone give me some input here? Thanks again, Chris
  23. Hi all, What I'm trying to do is dynamically add menu items to a menubar. I've got the code working, but now I'm trying to add an event handler to the menuitem so that when the user clicks on it, it opens the correct form. The problem is, the program doesn't know that the form exists. So, while creating the menuitem, I've inserted the name of the form that it should open into the tag property. The problem that I'm having is converting the tag value into a form, so that the correct form is opened. I've tried the following code (setting the tag value to the name of one of my forms), but it's not working for me, as the SelectedForm is showing up as null during runtime private void OpenForm(object sender, System.EventArgs e) { MenuItem ClickedMenu = sender as MenuItem; ClickedMenu.Tag = "Splash"; Form SelectedForm = new Form(); SelectedForm = ClickedMenu.Tag as Form; SelectedForm.ShowDialog(); } Is there a way the I can convert (or cast) the ClickedMenu.Tag to a form so that I can show the correct form? Thanks in advance, Chris
  24. Hi all, I'm working on an XML reader program for our support team to make a "human readable" form of an XML file. I have the XML file that is generated from a program whenever a support request is sent. The XML file has a breakdown of the registry keys on the user's computer that are specific to the program. The file is structured as follows: - <Registry> - <RegistryKey> <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">HKEY_LOCAL_MACHINE\Software\Company Name</Name> </RegistryKey> - <RegistryKey> <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">HKEY_LOCAL_MACHINE\Software\Company Name\Program Name</Name> - <Property> <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">VersionMajor</Name> <Value xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="int" regType="4">1</Value> </Property> - <Property> <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">VersionMinor</Name> <Value xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="int" regType="4">2</Value> </Property> </RegistryKey> - <RegistryKey> <Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">HKEY_LOCAL_MACHINE\Software\Company Name\Program Name\Version 1.2</Name> </RegistryKey> . . . . . Now, I need to build a treeview that looks like the REGEDIT in Windows, but I'm having a hard time getting the nodes set up correctly. Basically what I need to do is read the NAME value that includes the registry key and determine if the correct nodes have been added to the treeview. If not, then I need to add the appropriate nodes. This is where I'm running into problems. I've added the 5 root nodes into the node collection of the treeview control through the designer. But, when I go to add the "subnodes" at runtime, I just can't get them to display correctly. Later, I'll need to add the PROPERTY values from the XML file to a listview control so that when the user clicks on the node, it displays the property values in the listview. Does anyone have an idea on how I can do this without writing multiple FOREACH and IF statements? Thanks in advance, Chris
  25. Hi all, I'm having a problem determining if the "New Hardware Found Wizard" is currently running or not. Without going into the long details, my app installs the drivers for a hardware key during the initial run. After the drivers are installed, the app opens and functions normally. For whatever reason, the newer drivers appear to require anywhere from 5 seconds to nearly two minutes (machine speed not related) to run the �New Hardware Wizard� and find the USB hardware key. In previous versions, this never took more than seconds. The current install shows a dialog �no key found, try again?�. Instead of having the end user keep hitting yes, or selecting no when in seconds/minutes the key will be recognized, I want the ability to determine if the New Hardware Wizard is running and then if so I can appropriately assume that the key is still being found and not put up the retry prompt. The only way I have found thus far and is not ideal is to query the processes running on the system and if RunDll32.exe is running then I can �assume� that the �New Hardware Wizard� is running as RunDll32.exe typically is not running by default and most often would be running for a short period of time like in this instance. For reference, RunDll32.exe is used to call entry points in DLL files. If you call the following from a CMD prompt or Start/Run will start the general �New Hardware Wizard� RunDll32.exe shell32.dll,Control_RunDLL hdwwiz.cpl This would also be very useful since it is �better� for the end user to not connect the hardware key until prompted to do so (after the driver is installed) and if it can be determined the end user could be prompted �hey you have the key plugged in, unplug it until we say so!� If anyone has another idea (or a better way) of doing this, please let me know. Thanks in advance, Chris
×
×
  • Create New...