niallhannon's Q&A profile
Windows Forms Closing multiple forms
I assume there is a relatively simple answer to this but I'm relatively new to programming and can't quite figure out how to do this. I've got a main form which is opened automatically when the application is opened. I then make a choice (by selecting a radio button) and click on a button to open another form, hiding the original form. I then make another choice and open another form again hiding the previous form. I now want various options :- to close a form and show the previous form to close all forms and close the applications to close two forms in the chain and go back to the main form I'm not looking for a solution but examples of how to pass references to the previous form would be appreciated. There are sev ...Show All
SQL Server Predicting player win over a period of time
I would like to create a simple regression equation to predict player win on their next trip. I have tried to create the model using a linear regression tree based on two players (as a test). The result gives me a single node (expected) with only a coefficient instead of a regression equation. I can do this math by hand to get a regression equation and predicted value for the next trip for each player. The dataset I used for a simple test is..... Trip # Player Win 1 1001 1,250 1 1002 50 2 1001 1,450 2 1002 75 3 1001 1,600 3 1002 100 4 1001 2,000 4 1002 175 I also tried to predict next trip worth u ...Show All
Visual C# FILE* type in C#
I have a c api that I have to integrate. It is not COM. It is just plain c that was compiled into a dll. I have been able to wrap all functions except this one FILE** OpenFileWrite ( CHAR *); I need to be able to create a dllimport similar to this [ DllImport ( DllPath , EntryPoint = ApiNameMappings .OpenFileWrite )] public static extern OpenFile ( string FileName ); Any and all suggestions will be appreciated Here is your answer, you have to use an IntPtr. Here is the sig-declaration and the OFSTRCUT. But what are you trying todo Method signature: [DllImport("kernel32.dll")] static extern IntPtr OpenFile( string lpFileName, out OFSTRUCT l ...Show All
Visual Studio Team System Unit Testing Change
In CTP3 I can create a unit test for a stored procedure by right click on the sproc in the list of Schema Objects. In CTP4 this functionallity is missing (at least on my install). Should I be able to see the 'Create Unit Tests...' menu option on the context menu for a sproc One other thing I've noticed (that may be related) is that in CTP3 the sprocs show as dbo.SprocName while in CTP4 they show as SprocName.sproc.sql (i.e. the file name is shown rather than the name of the stored procedure) This should work, did you do this from the Solution Explorer or the Schema View In CTP4 you can only do this from the Schema View not from the Solution Explorer. -GertD "DataDude" Developement Manager ...Show All
Visual C# Windows Task Scheduler C# 2.0
I wanted to know if there is a task scheduler in C# (windows application). I need to start an application function at a specific time. Can someone point me in the right direction. How would I implement the code I want to run at the start of Windows I created a Windows Service according to one of the above articles, how do I get the windows service running in the start Thanks alot for your time! ...Show All
SQL Server Trouble installing SQL Server Express as part of Click Once Deployment
Hello, I've developed a desktop application for a company. It uses click once deployment and has a few prereqs: .NET Framework 2.0, j# .NET redistributable, windows installer 3.1 and SQL Server 2005 express edition. Most of the time the application downloads and installs fine. However, one user has a problem. I'm fairly certain it's machine / OS related and I wonder if there is a way to get around it. The user has a Windows 2000 machine, Pentium III, with 512 MB of RAM. On their first try, they received an error while installing SQL Server 2005 Express. The error code the user found in the install log was 70095. Apparently the user found some information directing them to install the current MDAC 2.8 SP 1. After rebooting and ...Show All
.NET Development DataReader problem (My final straw)
As a newbie to VB.NET I am rather please with a project that I am completing for my university course. There is one problem that has kept me from completing my project so far, and that is that I can not extract a value from the table of and Access database. To set the scene, I have a form that inserts the values from text boxes into variables and from variables to a database table. This works fine and I have no problems here. (see code below) What I need to do next is retrieve the customerID that is auto generated in the data base, this needs to be stored as a variable in the form and then passed to the next form so that it can be used to make a booking. I have got the code that passes the variable across the ...Show All
Visual Studio Express Editions Getting strings out of a big one with lots of \r\n
Greetings! :) I recently started programming with C# yesterday - I must say it's a bliss to program in it, and even better with the Visual Studio C# Express IDE, great job! :D ^_^ Now onto my question ^^... I connect to a server which sends me a big string with carriage returns, it LOOKS like this: 1011 INFO "Welcome to the server" 1000 ERROR "You are not authorized" 0020 MESSAGE User100 "This is a message! :D" However, as C# gets it (I think ) and the server sends it it's like... 1011 INFO "Welcome to the server"\r\n1000 ERROR "You are not authorized"\r\n0020 MESSAGE User100 "This is a message! :D" I need to get the first 4 numbers and the description to show the data correctly t ...Show All
.NET Development Unpacking/packing byte buffer in C++/CLI
I'm an experienced C programmer, but I'm new to C++/CLI and .NET 2.0. I need to unpack a buffer received from a UDP socket, and also pack a buffer going out on a UDP socket. In the C world, I would create a structure with all of the data elements in it, then create a pointer to the byte buffer and then cast that pointer as a pointer to the structure, then read/write the variables directly out of the structure (after doing byte ordering conversion on items that needed it). I get the impression this is taboo in C++/CLI, especially if I want to compile with /clr:safe, since regular pointers are considered "unsafe". What's the best way to do this in the C++/CLI .NET 2.0 world It would seem that this would be a common task in s ...Show All
Visual C# Partial class inheriting from another partial class?
Okay, lets suppose I have three pages - customsearch.aspx This is my main ASP.NET page. Lets suppose it has an asp:Literal called 'warningMsg' - searchtemplate.aspx.cs This is a 'base' class which defines some functionality and methods I want in all 'search' pages. It extends the 'Page' class, obviously. - customsearch.aspx.cs This extends the 'SearchTemplate' class, overriding a few selected methods and adding any custom ones I need. So first off, I do all of this using 1.1 style code behind: (only relevant code shown) - searchtemplate.aspx.cs [code] public class SearchTemplate : System.Web.UI.Page { public Literal warningMsg; //other controls here void Page_Load(Object sender, EventArgs e) { warningMsg.Text = "Page Load ...Show All
Smart Device Development RFID with Keyboardwedge
Hi, I have a Ipaq with rfid reader. When I am in notepad/word i can press a hardwarebutton and the id of the rfid tag will be entered by the keyboardwedge. So I thought oke lets do that in a c#program :) It works when i have a textbox with focus. My problem is that i dont have a textbox on the form and i dont want to put one because an user isnt allowed to see the id. I used the keypreview = true and a key_down event. When I scan the event is triggered but only once and i get a keycode=none . Does anybody know how to solve this or any other easy way to create an 'automatic' keyboardwedge Grtz Annihil8 You said in your original post that it works if your form has a textbox with the focus, b ...Show All
Visual FoxPro How to preview the data from formset to report designer?
Hi I have problem setting the exact information from formset to report designer. For example There is re_depot field in the tnrepair.DBF. In tnrepair table, there are inputs such as CHEM, CPDG, SHOC, PTGS, etc… I key-in CHEM in the textbox on the formset and then CHEM is preview on the report designer. The coding is “ report from report designer for re_depot = thisform.textbox.value while not (deleted()) preview “ As for this coding, it cannot get to preview when after I click the command button. Why cannot it work well Thank you. SET DELETE ON cInput = SubStr(thisform.textbox.value,1,4) && assuming the length of re_depot is ...Show All
Visual C# Whats the equivalent of __LINE__ and __FILE__ in C#
Whats the equivalent of __LINE__ and __FILE__ in C# I thought this hot-button issue would have been answered by now. But no one seems to have a good answer for this. I would love to see a solution which presents no runtime overhead. What about C# 3.0 does it address this issue If you want to log exception information then the exception itself should give you enough inormation. I think that if you want to use fault logging then you'd best use the System.Diagnostics namespace. Don't worry about the overhead. It's not that much and if you'ld only use for fault logging it doesn't really matter that it takes a little bit more time. Because the clr is a virtual machine, there's enough information you can query when thinks go wrong. In tha ...Show All
SQL Server Retrieving native progress events for a 2000 package from SSIS. Is it possible?
Dear all, AFAIK I don't think so. Let me know if possible and how. I'm talking about a SSIS package which owns a Execute DTS 2000 Package Task and from there it calls a DTS 2000. Programatically, from our VB .Net front-end app we're seeing only SSIS events (when validate and execute methods are called) and any kind of information is provided from RCW proxy (I suppose that internally it gonna be created in order to send messages between managed and unmanaged code). When a task inside our DTS 2000 fails we're awaring by means a "generic message" such this: Error: System.Runtime.InteropServices.COMException (0x80040427): Execution was canceled by user. at DTS.PackageClass.Execute() at Microsoft.SqlServer.Dts.Tasks.Ex ...Show All
SQL Server Generic Audit Trigger CLR C#(Works when the trigger is attached to any Table)
This Audit Trigger is Generic (i.e. non-"Table Specific") attach it to any tabel and it should work. Be sure and create the 'Audit' table first though. The following code write audit entries to a Table called 'Audit' with columns 'ActionType' //varchar 'TableName' //varchar 'PK' //varchar 'FieldName' //varchar 'OldValue' //varchar 'NewValue' //varchar 'ChangeDateTime' //datetime 'ChangeBy' //varchar using System; using System.Data; using System.Data.SqlClient; using Microsoft.SqlServer.Server; public partial class Triggers { //A Generic Trigger for Insert, Update and Delete Actions on any Table [Microsoft.SqlServer.Server. SqlTrigger (Name = "AuditTrigger" , Event = " ...Show All
