536 Posted Topics
Re: In case you have not yet figured this out. in your query [I]@offensebeat[/I] is entered as "@offesebeat" and [I]@offensestate[/I] is entered as "offensestate" Next time please remember to use [noparse][CODE][/CODE][/noparse] tags around your code to make it easier to read. | |
Re: Everything is displayed in a window, event the screen savers. For screen savers the window is full size and has no borders or title bar. You can do the same thing with the c# forms. Set the form's [I]FormBorderStyle[/I] property to [I]None[/I]. [B]Note[/B]: Make sure you have a way to … | |
Re: You can also use the [ICODE]ExecuteScalar()[/ICODE] command instead of [ICODE]ExecuteReader()[/ICODE]. This does the reading for you and extracts the value (value can still be DBNull though). To get aroung the DBNull issue it is possible to use a nullable type. [URL="http://msdn.microsoft.com/en-us/library/1t3y8s4s(VS.80).aspx"]MSDN Nullable Types[/URL]. E.G.[CODE]int? value = cmd.ExecuteScalar() as int?; label2.Text … | |
Re: You can do the same thing dynamically using a DataTable. [CODE] DataTable Employees = null; private void BuildTable() { Employees = new DataTable(); Employees.Columns.Add("Name", typeof(string)); Employees.Columns.Add("DOB", typeof(DateTime)); Employees.Columns.Add("Department", typeof(string)); } private void StoreEmployees() { DataRow row = Employees.NewRow(); row["Name"] = "John Smith"; row["DOB"] = DateTime.Now; //recruit them young! :p row["Department"] … | |
Re: You can attach to the process once it has started (Debug Menu - Attach to Process), but for some service related tasks blocking the process with a break point introduces timing delays that can cause the service to operate incorrectly or fail completely. The best way is to use a … | |
Re: [QUOTE]But it doesn't work, neither .ToString(). [/QUOTE] How does it not work? If you get errors then please post these. If the result is not what you expect, then explain how the result is in error. Try examining the value of the returned object. Break the line in to two … | |
Re: Just use the save method of the image. [CODE]pictureBox1.Image.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);[/CODE] | |
Re: [B]Answer 1 : How RadioButtons work[/B] Provided that the radio buttons are all in the same container then only one of them is ever true (Checked). Setting any one of them Checked automatically un-checks the others. So you could just do [iCODE]rbReceived.Checked = true;[/iCODE] When you click on a check … | |
Re: According to [URL="http://msdn.microsoft.com/en-us/library/ms646280%28VS.85%29.aspx"]WM_KEYDOWN Message[/URL] you need to set bit 30 of the LParam to indicate that the previous key is still down. Try this. [CODE] PostMessage(hWnd, WM_KEYDOWN, VK_ALT, 0); PostMessage(hWnd, WM_KEYDOWN, VK_F, 0x40000000);[/CODE] | |
Re: The following thread might help. [URL="http://www.daniweb.com/forums/post1282604.html#post1282604"]Printing Panel in C# desktop Application[/URL] Not sure how this will handle OpenGL / DirectX rendered image though. | |
Re: If you only have a PictureBox and Label on your custom control then consider removing them and painting the image and text manually using the graphics object in the OnPaint event for the control. Then you will have complete control of the image on the control and can rotate it … | |
Re: The clue is in your original requirement. [QUOTE]I want to set the background image of form [/QUOTE]You need to set the [I]Form.BackgroundImage[/I] property. [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.backgroundimage.aspx"]MSDN BackgroundImage Property[/URL] | |
Re: You can also read all the lines in one go in to a string array without having to worry about creating a [I]StreamReader[/I]. [CODE]string[] lines = File.ReadAllLines(FILENAME);[/CODE] | |
Re: Another way to set the value of a combo it to set its [I]Text[/I] property. For the DGV combo the Text property is the cell [I]Value[/I]. So you need to make sure the new row has the value you want to see in the combo column field. This might work: … | |
Re: Look at the example here [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.listcontrol.valuemember%28VS.80%29.aspx"]ListControl.ValueMember Property[/URL] [B]Note[/B]: Your [I]ListItem [/I]constructor is missing a closing [iCODE]}[/iCODE]. Set up the combo like this. [CODE] // create a list of ListItem objects to use as the ComboBox.DataSource List<ListItem> listitems = new List<ListItem>(); listitems.Add(new ListItem("ID1", "Name1")); listitems.Add(new ListItem("ID2", "Name2")); listitems.Add(new ListItem("ID3", "Name3")); listitems.Add(new … | |
Re: Change the static variable to a static property. You can then call an event handler in the set method. You will need a static event of a valuechanged delegate. So that each new instance is notified of the change, they will need to attach to the event. [CODE] class MyTestClass … | |
Re: Yes, this image is held in a resource file. When you set a button's image you have the choice of [I]Local resource[/I] or [I]Project resource[/I]. For a [I]Project resource[/I] you choose an image from one already loaded in to (or add one to) the application wide resource file. For a … | |
Re: In [B]Program.cs[/B] you should find a line like this [iCODE]Application.Run(new Form1());[/iCODE] To run [I]Form2 [/I]first just change [I]Form1[/I] to [I]Form2[/I]. | |
Re: If you have a VS Setup Project then you can have the Setup project automatically install the framework for you as a [B]Prerequisite[/B]. [LIST] [*]Right click on the Setup project [*]Select [I]Properties[/I] from the bottom of the menu [*]Click on the [I]Prerequisites...[/I] button [*]Confirm [I]Create setup program to install prerequisite … | |
Re: When there is only a cursor the [I]SelectionLength[/I] will be 0 and the [I]SelectionStart[/I] is the cursor position. Use [iCODE]richTextBox1.SelectionStart[/iCODE] property. | |
![]() | Re: This is the method definition. [iCODE]private void al(String password, string name)[/iCODE] How many parameters (arguments) does it take? |
Re: You need to use the [B]event [/B]keyword and put the delegate outside the interface. Like this: [CODE] delegate bool ValidateObject<T>(T obj); delegate T CreateNewObjectGame<T>(Game1 game); interface Interface1<T> { event ValidateObject<T> Validate; event CreateNewObjectGame<T> CreateNewGame; } class testClass : Interface1<int> { #region Interface1<int> Members public event ValidateObject<int> Validate; public event CreateNewObjectGame<int> … | |
Re: When you check the checkbox cell you set col 7 to "CheckIn". When you uncheck the checkbox cell you test col 7 for null. You need to re-think the test logic again. [CODE]int clmnIndex = e.ColumnIndex; int rowIndex = e.RowIndex; if (clmnIndex == 8) { DataGridViewCheckBoxCell chkBox = (DataGridViewCheckBoxCell)dgvAttendance.Rows[rowIndex].Cells[8]; if … | |
Re: C# is case sensitive! [iCODE]IsConnected != isConnected[/iCODE]. Look at your code again. [Edit] @farooqaaa: Maybe you should edit your blog post! | |
Re: If you have a BindingSource you can use the [I]Filter[/I] property of this. It take a string similar to the WHERE part of an SQL query. E.G. "Area='Selected Area 1' OR Area='Selected Area 2'". In your [I]Submit[/I] button get the selected [COLOR="Green"]Area [/COLOR]and [COLOR="Green"]Name [/COLOR]values from your listboxes using the … | |
Re: [QUOTE=ddanbe]Did you know this site has a search function?[/QUOTE]The basic search offered by this site at the top is usually very unhelpful. Entering this thread title does not give the thread you linked. In fact the only C# thread it gave is this one, and that is 10th in the … | |
Re: You can add stored procedures from VS if you open the DB in the Server Explorer ([I]View Menu - Server Explorer[/I]). If your DB is not already in the window then you will have to open it using the [I]"Connect to Database"[/I] button at the top of the window. Once … | |
Re: I must agree with you on how the Validation events operate. I also do not like that the user must begin to move away from the control before validation occurs. However, you can block the move so the focus remains on the current control (cell) by setting the Cancel property … | |
Re: I think the way the cascade works is implemented in the MDIparent form and is automatic. The only way I know to create a different effect is to implement it yourself by looping through the [I]MdiChildren [/I]collection. | |
Re: You probably need to use an asynchronous read by calling [I]BeginOutputReadLine[/I] and setting an [I]OutputDataReceived[/I] event handler. I have no experience with it, so I can only direct you to the MSDN help. [URL="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.beginoutputreadline.aspx"]MSDN Process.BeginOutputReadLine[/URL] Maybe someone else can offer some more experienced advice. | |
Re: The combobox column is used when adding or editing a cell to select a new value for the cell from a list for pre-defined options. The value displayed in the cell is always the value from the database or dataset. You can not initialise the value as this comes from … | |
Re: What version of crystal reports are you using? The one I have (default install with VS2005) supports A4, A5, B5, Legal, and Letter as standard. But, when I choose to use a printer it offers the paper sizes supported by the printer. (Perhaps this is your problem. I.e. your printer … | |
Re: You neeed to close the filestream in form1. [Edit] As it is now it will only close when the GC disposes of the filestream. | |
Re: Assuming that "checkbox1 and checkbox2" are CheckBox controls on you form you can use the Tag property to link the TreeNode and the CheckBox control. When you add the TreeNode [CODE] // get root node TreeNode rootNode = treeView1.Nodes[0]; // create new tree node TreeNode tn = new TreeNode("Child1"); // … | |
Re: It is a long time since I did anything with modems, but if I remember right, if the modem is connected you need to send "+++" to get it in to command mode before it will accept any "AT" commands. Otherwise the command is sent down the wire. | |
Re: The article you noted is very old (about March 07, 2002) and using the mscomm.ocx is no longer necessary in .Net. I have found the mscomm.ocx has problems with loosing packets and memory leakages. There is a native .Net serial port [I]System.IO.Ports.SerialPort[/I] that I would strongly recommend that you change … | |
Re: What does "[I]when i select the frst data its not working[/I]" mean? How do you select the first data? What happens? or does not happen? How do you know "[I]It save in the database properly[/I]"? | |
Re: Use Panel.DrawToBitmap to copy the panel to a bitmap and then print that. You will need to re-order the controls in the panel as the DrawToBitmap method paints the controls in the wrong order. (Don't know why). I use this code I got from another forum; I think it is … | |
Re: You can still use VB object and functions in C#. Add a reference to "Microsoft.VisualBasic" (Project Menu - Add Reference - .Net tab). Then you can use [I]Microsoft.VisualBasic.Interaction.InputBox(...)[/I] [Edit] - Using farooqaaa's or Ryshad's idea is more efficient as it does not require linking to the VB library. | |
Re: I think you should be using [I]Invoke [/I]not [I]BeginInvoke[/I]. [I]BeginInvoke [/I]is asynchronous and requires an [I]EndInvoke [/I]some time later. You also need to pass the parameters for the Invoked method. [CODE] if (InvokeRequired) { this.Invoke(new SolveDrawMaze(DoMe), new object[] { aCell}); } [/CODE] | |
Re: Please remember that the character count and byte count are not the same. The byte count will depend upon the text encoding (ASCII, UTF8 etc.). | |
Re: By default the text displayed on the button comes from the [I]FormattedValue[/I] of the DGV cell. (i.e. the button shows the contents of the cell it is on). If you set the [I]UseColumnTextForButtonValue[/I] property of the column to true then the [I]Text[/I] property of the column is used instead. [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewbuttoncell.usecolumntextforbuttonvalue.aspx"]See … | |
Re: Nowhere are you setting the values for the objects oXL and oWB. I suspect the null exception is due to this. You cannot manipulate an excel file without opening it. Your [I]removeEmptyCols[/I] method does not open any files nor does it even know which file it is working on. You … | |
Re: Ctrl+Alt+Del is captured by the OS and is not easily blocked. Your C# app never sees the key combination. There are a few work arrounds that can be found by Googling. Most of these involve low level hooks and can lead to crashing the OS if not implemented properly. Unless … | |
Re: Not sure what you want to do but the following is something to look in to. If you set the form's [I]TransparencyKey [/I]property to the same colour as your form's background then the background becomes transparent and click events pass through the form to the window/object behind. If you then … | |
Re: Guys, did you notice that this thread was started over a year ago! Please don't post to old threads. @badr9: I think shashank185 has the right answer but if you want others to help then maybe think about starting a new thread. | |
Re: Try [iCODE]richTextBox1.Select(charPos, 0);[/iCODE] to move the cursor to after the charPos'th character. | |
Re: The error probably means your xml file is missing some required declaration at the begining. Can you show some code and the xml file. | |
Re: Check you logic here [CODE]if (dis.Exists == true) <--- ? { dis.Create(); }[/CODE] Also, you are using a fixed string here [CODE]fri.MoveTo(@"C:\new2\newnew\" + "1(" + iCtr + ").txt");[/CODE] | |
Re: Consider using a [I]DateTimePicker [/I]instead of a [I]TextBox [/I]for the the date/time value. This will remove the posibility of someone entering the date in an invalid format and the [I]Value[/I] property is already a DateTime so no convertion is needed. Also, make sure you are validating the format of all … |
The End.