- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 35
- Posts with Upvotes
- 30
- Upvoting Members
- 26
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Moving from Delphi to C#. Many years in SQL development. When not programming, I ride horses.
- Interests
- Morgan Horse Shows
291 Posted Topics
Well I guess it is my turn to ask a question, since most of the time I spend answering questions on DaniWeb. The Problem: DataViewGrid throws a "System.ArgumentException parameter is not valid..." when the dataset contains an SQL 2005 TimeStamp type column. The error occurs in System.Drawing.FromStream... da da da … | |
Re: There are a number of ways to do this. Using directing insert statement is one, another is using a stored procedure, calling as ssis package is another. The easiest is probably the insert statement. Simple get you SqlConnection, then use an SqlCommand. use the string.Format method to parse the data … | |
| |
Re: I sugest you take a different tact. What I typically do for managing thread messages is I create a simple EventArgs class to hold the message information, a Delegate to represent the main thread method that will use the information, and an eventhandler in the main thread that can be … | |
Re: Let me re-state your question to see if I understand you correctly. You have two forms. First form has a check list box, and the second form has a listbox. When the user checks an item in the check list box, you want that item to be added to the … | |
Re: As danielernesto said, store it to a column type that supports byte arrays such as Image or VarBinary(max). // Jerry | |
Re: [URL]http://www.thescripts.com/forum/thread224354.html[/URL] | |
Re: I have attached a project that demonstrates how to do this. Jerry | |
Re: #3, you can't stop it from sending the a minimize command (without some Windows API calls), however if you want it to do more things before it minimizes, you can use the Deactivated Event handler or the SizeChanged event ([URL]http://www.thescripts.com/forum/thread275452.html[/URL]). If you want to stop the minimize action, then you … | |
Re: Doesn't close because the while statement runs out of reads, and drops into the dr & lgnconnection close... It does not make sense to have both the true and false of a conditional result in the same statement "Close()". Why compare at all if the result is always going to … ![]() | |
Re: Instead of using a private bool variable, use a private variable for Form2, then you have some options... [code] public partial class Form1 : Form { private Form2 _form2 = null; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; _form2 = new Form2(); … | |
Re: Are you speaking of the Header cells, or a data cell ? I havn't tried it on tried it on the header, however I am pretty sure it can be done. If you are speaking of data cells, you can use the CellFormatting([COLOR=#0000ff]object[/COLOR] sender, [COLOR=#008080]DataGridViewCellFormattingEventArgs[/COLOR] e) CellFormatting event to set … | |
Re: Writing an ini parcer is pretty straight forward. I have attached a class library that I use, and included the source code for you to check out. | |
Re: Yes you can do this. I have a service that does this type of work for archiving files. Remember that a mapped drive is in the context of the currently logged on user. A Windows service runs in its own context. So, your mapped drive may not be visible to … | |
Re: As BlackSun explained, you will need to manage it yourself using the image Graphics. It is a bit more complicated than the example above, but should move you into the right direction. The image onPaint event will have to remember that you have an active selection (the rectangle, and its … | |
Re: What Ramy is saying is that you do not specify a File name, but rather a ConnectionString. [code] SqlConnection conn = new SqlConnection("Data Source=Servername;Initial Catalog=Marketing;Integrated Security=SSPI"); conn.Open(); [/code] | |
I have the multiple level path of a filename, and I want to pull out just the immediate parent directory name of this file. Example: Filename = "c:\temp\extra\test\myfile.txt" How can I get "test" from this string ? Thanks in advance Jerry | |
Re: "Give same Code ??" Do you mean giving them all the same event handler ? then let the event handler determine the button that was used ? | |
Re: Another hint for you, Your assignment says to compute the rate at 7.5 for the first 40 hours, and 11.25 for each additional hour. Your condition is only checking for if the hours equal exactly 40 hours then use 7.50, else use 11.25. So with your condition, if worked any … | |
Re: It all depends on when you are letting the user delete the file. Even through the dialog is closed, does not mean it has been disposed by garbage collection. To insure you no longer have the picture file handle open, before closing the dialog (or in the FormClosed event handler), … | |
Re: Instead of mangling the SQL statement (embedding CRLF), just iterate through the rows and columns, and populate the text box. Here is a simple example: [CODE] private void toolStripButton1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection("Data Source=SHAWHP;Initial Catalog=SalonWiz;Integrated Security=True"); conn.Open(); DataSet ds = new DataSet(); SqlDataAdapter adapter = … | |
Re: Here is a snip of code from my Login screen. It has the usual Server Name, User name and Password texboxes, and a Login and Cancel button. Mine is hardcoded for a database named SAFEnet. This is using the SQLclient (SQL2005). If you are using another type DBMS, let me … | |
Re: You will be wrapping the code that creates the database anyway, so just supply good error messaging and go with the assumption. IOW, why add additional code when SQL is going to do those checks for you anyway regardless of your pre-checks. JMO | |
Re: Why so much code? Try this to get started [code] static void Main(string[] args) { string[] meals = System.IO.File.ReadAllLines("meals.csv"); foreach (string meal in meals) Console.WriteLine(meal); Console.ReadKey(); } [/code] | |
Re: Look at [URL]http://msdn2.microsoft.com/en-us/library/system.windows.forms.keypresseventargs.keychar.aspx[/URL] then after e.Handled = true; set focus to the next control / textbox. | |
Re: Are you aware that the Jet engine is very picky about the dBase file version. This is why I prefer to use the ODBC classes instead of Ole. I had a similar problem using your code, and after switching it out to use ODBC, everything worked fine, and even a … | |
Re: First, your ASP is the one connecting to the database using the credendials of the web site setup. (Windows authentication mode). You are to validating the information from the login screen against the database. Just keep in mind that SQL sees the web service as the one logged in not … | |
Re: ***what is MyGrid referring to in this code ^^^ ???*** [U]Answer: A DataGridView[/U] ***hi ... how to create the stored procedure?, and how to call the stored procedure in c# ?.... *** [U]Answer: Creating a stored procedure is done at the SQL Server using the tools provided by the database … | |
Re: [code] ************************************************************************************************** private void ShowForm(DataTable dtDagChauff) { if (FrmZTour == null ) { FrmZTour = new FrmDgvZoomTour(); FrmZTour.SelectTour += new FrmDgvZoomTour.SelectTourHandler(DgvTourSelected); FrmZTour.FormClosed += new FormClosedEventHandler(FrmZTour_FormClosed); FrmZTour.Show(this); } FrmZTour.FillDgv(dtDagChauff); } private void FrmZTour_FormClosed(object sender, FormClosedEventArgs e) { FrmZTour.Dispose(); FrmZTour = null; } [/code] | |
Re: What you need is a place in your MyProgram.cs class to store the command line arguments received in the constructor (Main). Something like public string SelectedFile; In the Main constructor, do this: [code] public static void Main(string[] args) { string SelectedFile; if (args.Length > 0) { SelectedFile = Convert.ToString(args[0]); MessageBox.Show(SelectedFile); … | |
Re: There is a variety of ways to do this. I will show you the one I use most often. It all boils down to variable scoping. Form2 (child) needs to be able to see Form1(parent). There are two properties in a Form (Parent and ParentForm), however you can not rely … | |
Re: I tried them out in 2008, and the directory browser's path does not react correctly. You can add some text boxes to your form that are populated with the new path from this component as you select or even double click around on the dir component... It fails 90% of … | |
Re: Take a look at the DateTimeOffset struct. Also the TimeZone class You should be able to use those and then use the DateTime AddHours method to get the new date you are looking for. //Jerry | |
Re: I not sure how you can do it from within your user control, but you can experiment around using the tabcontrol's selecting event handler. Have the save button set the _saved var. [code] public partial class Form1 : Form { private bool _saved = false; public Form1() { InitializeComponent(); } … | |
Re: You may have stumbled upon a known bug within the grid's internal binding logic. But, before I say that for sure, maybe you should post some code that shows your symptom, and we will see. I assume you have a binding source for the grid ? | |
Re: Here is a simplified way of doing it. Typically, If using a database, I would avoid using the category class all together but that is not what you were asking for. Anyway, All this form has is a TreeView component and an untyped dataset. The onLoad takes off and loads … | |
Re: I assume you have already figured this out on your own ? | |
Re: Just a thought, but you could use the PictureBox control and make it look however you want. You can swap the image out based on Mouse Enter / Leave, and Click events. That gives you total control of what the user sees. Jerry | |
Re: Setting the Enable property of the grid will prevent the user from moving to any subsquent rows. You may have to manually prevent them from selecting that row by trapping the row in the Select event. Then setting the CurrentCell to the next selectable row. This could get messy because … | |
Re: [QUOTE=ananthu;1107751]i need to read contents of a file(of any format) into a char array, how can i do this[/QUOTE] [code] FileInfo fz = new FileInfo(tempFile); FileStream fzs = fz.Open(FileMode.Open, FileAccess.Read, FileShare.Read); byte[] data = new byte[fz.Length]; fzs.Position = 0; fzs.Read(data, 0, Convert.ToInt32(fz.Length)); string strData = Encoding.UTF8.GetString(data); char[] ch = strData.ToCharArray(); … | |
Re: adatapost gave you exactly what I would have done. But if you really want to know what to put in that space you have tagged as "WHAT TYPE HERE?" [code] // Display items in the ListView control foreach (DataRow row in dtable.Rows) { //WHAT TYPE HERE? listViewUsers.Items.Add( new ListViewItem(new string[]{ … | |
Re: Or simply post the variables in the constructor. // Jerry | |
Re: The SQL Column type you are looking for is either Text or nText. This is a blob field that allows any content you want. Inorder to populate or download from this type of field, use the byte[] array and stream classes. The are ample examples on DaniWeb, CodeProject, and Google … | |
Re: Well, is this RFID reader transmitting over sockets ? Most RFID readers are serial (Com) or USB devices. When incorporated into a hand-held or POS unit the information surrounding the RFID is usually wrapped along with other information as to the location (register, etc). So your question must be expanded … | |
Re: If the receivers of the event absolutely must have the information back into thier own thread (like a Windows App sometimes does) then you would handle the invoke for arguments in those receiving threads. Move your delegate out into the name space so that receivers outside of this class can … | |
Re: When you scrub off all the fluffy help methods like WriteLn etc, you see that all communications through the comport are actually in byte[] format. Your BMP can be placed into a byte array, and sent to the comport. | |
Re: CheckListBox is subclassed from ListBox. The SelectionMode is valid in the ListBox control, but only None and Single in the CheckListBox. It is not a true error! But, the programmer should have overridden the property and used a subset, or just a bool to allow selection or not. Multi select … | |
Re: Maybe setting the first enum as an Error so when they do not give a value then you can tell they didn't supply a value. | |
Re: I changed your code so that you can actually click on the other buttons. [code] public partial class Form1 : Form { private int controlnum = 0; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Button homebtn = new Button(); this.panel1.Controls.Add(homebtn); homebtn.Text = "New Button" + … | |
Re: use type image instead of varbinary(max) |
The End.