Answer Questions
xlordt Printing to a dot matrix printer without feeding an entire page
I need to be able to print a number of lines to a dot matrix printer, but not have a full page length feed through the printer when I send the PrintDocument for printing. Thus far, printing in the traditional .NET fashion spools an entire page out. There must be a way to do this, but I can't find it. Ideas probably using the SerialPort classes in .NET 2.0 to have direct access to the printer and communicate with it but the commands for the printer etc.... would have to be obtained in some way. http://msdn2.microsoft.com/en-us/library/system.io.ports.serialport.aspx No there isn't. Remember that in WIndows, many programs could be printing at once, so windows will not start printing a docum ...Show All
kmishle How can I access parameters given from the Command Line?
If I choose to run a program the following way Start > Run "MyCSharpApp.exe" "Some Text" How do I access "Some Text" TIA Mike Could you be more specific with what didn't work The Main method should be application's default entry point which gets called every time the application is started. [The default Main method is located in the static Program class in Program.cs]. Andrej If you are creating a Windows application, than unfortunally Console.WriteLn does not do anything. While in the debugger you see the output in the output window, but if started from the commandline it doesn't. The Windows app does not have a hook to the commandline. Of course if you made a console application i ...Show All
daraneko Problem with function with lot of parameters
Hi, I have a strange problem. I get a dataset with values, within a function, and after that I call a different function with a lot of parameters. When the call to this other function is present, the dataset values will become non existing (see error message), even before getting to the other function in debug mode. This is the error message I get: Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible, possibly because the code is optimized. When I remove the call to function "SetFieldValues" it works fine. Another thing when the function that i call ("SetFieldValues") has only string parameters it works fine. This is the code: private void LoadFiel ...Show All
Chris McLeod Help fixing my catch mehod
I need to write additonal catch code that if there is not any or a new Asettype that it creates a error.kml file or it continues not matter what. How it is now it fails if there is a new asset type and it is not in the styles.txt file. CODE::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: public void GenerateKmlFilesFromLatestOrbitImport( ) { string connString = GetRegValue("FemaDbConn", "").ToString(); string styles = GetStyles(); string kml=""; string mastermap=""; int orbitImportId = GetOrbitImportId( connString ); DataSet assetTypes = GetAssetTypes(connString); if( assetTypes.Tables.Count > 0 && assetT ...Show All
manukahn Build up a variable name with a string
Hi, I wonder if there's a way (in c#) to build up a variable name by the concatenation of two strings...For example int intTest = 1; string strTest = "strTest"; string strTest+intTest.toString() = "this is my new var"; Thanks in advance James Curran wrote: What does Array have to do with the subject (where Column() is an Array) I am really sorry for a misstatement. The macros are not used in the constructor in VFP but you can use them to significantly simplify the constructor as I will show on C# example. I want you, James, to figure out how I can do it with Arrays in here. It will be very helpful for me. I glued up 24 statements from ...Show All
Kiwi Ranger Security - normal practise? Please reply
Hi, I'm building an app in C#. I won't bore you with the details, but basically I have two security questions. Any help would be much appreciated! 1. I will be saving files on a external server. I would like to encrypt the files before sending them. Different 'users' will be using this app. What are the best practices regarding C# to encrypt files Public/Private key encryption Where would I store the keys...in the registry I'm well versed with regards the cryptography in theory, but do not have much experience in practise. What API's....where Etc, etc...Any ideas .. 2. The application be will be using a third-party service, which requires a username/password. I suppose this username and password will be kept on a database somewh ...Show All
shax Check for Updates!!
How can I make a (Check for Updates) options to allow my application to check for an update from a specefic path and update the existing installed version If you're using ClickOnce, this path is set at application's design time and can't be set from installed application, when running on the client. However, you can change it on the web server (or whetever the installation is) by updating application's manifest files. Andrej ahmedilyas wrote: there are many ways of doing this. Personally I created a webservice to do so. I call up the webservice, give it my application details (name, version etc...) and the webservices gives me the updated file going through the directories of my webserver, finding the e ...Show All
Omar Fawzi How can I share my custom user settings (ApplicationSettingsBase) with several objects?
In my program I have several classes: WebServer EmailClient TelnetClient ...and they all use configurable data which I have in a class called "GNotifyUserSettings" (which is a descendant of ApplicationSettingsBase). Do I need to create a GNotifyUserSettings object in every class I want to use custom settings in ...or should I pass in an object reference to the user settings object to every class Neither method seems very clean. What I'd really like is a "global object" that every class can access... (and it must be thread-safe) I'm using VS2005, but I'm trying to do everything programatically... Sorry about taking a bit to get back to yo ...Show All
Fositron Need help converting VB to C#
Hi Can someone help me by converting this VB to C#. Thanks a bunch. James Keele Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox(Modulo10(TextBox1.Text)) End Sub Private Function Modulo10(ByVal strNummer As String) As Integer 'strNummer may only contain numbers between 0 und 9! Dim intTable(10) As Integer Dim intTransfer As Integer Dim intIndex As Integer intTable(0) = 0 : intTable(1) = 9 intTable(2) = 4 : intTable(3) = 6 intTable(4) = 8 : intTable(5) = 2 intTable(6) = 7 : intTable(7) = 1 intTable(8) = 3 : intTable(9) = 5 For intIndex = 1 To Len(strNummer) intTransfer = intTable((intTransf ...Show All
rmscandy Define attributes for a property
Hello! Does anybody know how do I define an attribute for a property Like this: public class Test { [myproperty's attribute - how to define it ] private string MyProperty; } After defining it, I should use it via Reflection. Will it be shown in Attributes collection of PropertyInfo class Thanks! You create a class derived from System.Attribute, add the AttributeUsage attribute to it and make sure it includes AttributeTargets.Property. Once you've applied the attribute it will indeed show up in PropertyInfo.Attributes. A property has a get and/or set accessor, like the MyProperty in my example. The _myField should be returned by GetFields, and MyProperty by GetP ...Show All
A_RODRIGUEZ01 multithreading
I need to do multithreading. It is my fist attempt. It failed. This is the setup: There is a form with tabControl and a few pages. There is a progress bar on one of them. It is supposed to measure progress of file downloading. WIthout multhithreading it is dead while the files are downloaded and then in the end it jumps to 100%. This is what I did. Everything compiled but the progress never was activated even after the downloading was over. In other words my code actually made the things worse. In the main form I put in this code at the start of procedure that is handling the download: ThreadStart threadDelegate = new ThreadStart ( Work.DoWork ); Thread newThread = new Thread ( threadDelegate ); newThread.Start ( ); T ...Show All
A fish How to DllImport this struct?
// C++ struct SM_PARAM { char SCA[16]; char TPA[16]; char TP_PID; char TP_DCS; char TP_SCTS[16]; char TP_UD[161]; char index; } ; How deal as C# struct i think this depend on the function you will pass this structure to it any way is this worked after you change it to CharSet.Ansi I think there should be [ StructLayout ( LayoutKind .Sequential,CharSet= CharSet .Ansi)] try this try this [ StructLayout ( LayoutKind .Sequential,CharSet= CharSet .Unicode)] struct SM_PARAM { [ MarshalAs ( UnmanagedType .ByValTStr, SizeConst = 16)] string SCA; [ MarshalAs ( UnmanagedType .ByValTStr, SizeConst = 16)] string TPA; char TP_PID; char TP_DCS; [ MarshalAs ( Unmanaged ...Show All
John Hennesey MAPI/CDO error
I am using C# to connect to exchange, and iterate through all of the message headers. To test, I had a button on a windows form that would call the method, and it worked perfect. However, this application will always be running, and needs to be on some type of timer.. no problem.. so I setup a timer, and created an ElapsedEventHanlder that is called each time the timer iterates.. However, when I call the same method in that event, this error is thrown: Retrieving the COM class factory for component with CLSID {3FA7DEB3-6438-101B-ACC1-00AA00423326} failed due to the following error: 80010106. On this line: Session mySession = new MAPI.Session(); Anyone have any idea why calling the method this way could cause this you ...Show All
Mathieu Cupryk Can i develop web application using window control?
Anyone know how i can develop a web application and using window control You don't put the wheel of your skateboard under your car. It's the same with Winforms controls, you don't put them on a website. In a web application you spit Html to the browser, Winforms controls aren't developed to be rendered in Html, they paint themself. If you want a rich interface in you web application, I suggest to take a look at Atlas. This works great and comes with alot of fancy controls out of the box for free! You can find more information about Atlas and some great examples here: http://atlas.asp.net/Default.aspx tabid=47 Thx for ur answer ...Show All
r3n Run Console Application from Remote Share!
Hi, I have created a simple console application that gets the users username and computer name and updates a sql database so admin staff can find the computer the users are logged onto. The problem I have run into is I want this to run from a network share each time they logon and I can't figure out how to do it. If I install it locally and run it on logon it works fine, but I was hoping since is such a simple program that doesn't require user interaction I could just run it from a network share and not have to deploy it. Is this possible Thanks in advance for the help!! Thank you both! Does this have to be done on each workstation or just once For this o work fine, You ...Show All
