536 Posted Topics

Member Avatar for sidmendiratta

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.

Member Avatar for nick.crane
0
137
Member Avatar for selflearning

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 …

Member Avatar for selflearning
0
109
Member Avatar for AngelicOne

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 …

Member Avatar for Geekitygeek
0
984
Member Avatar for sadhawan

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"] …

Member Avatar for Geekitygeek
0
164
Member Avatar for geoNeo_

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 …

Member Avatar for geoNeo_
0
85
Member Avatar for AngelicOne

[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 …

Member Avatar for Lusiphur
0
443
Member Avatar for jackabascal

Just use the save method of the image. [CODE]pictureBox1.Image.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);[/CODE]

Member Avatar for nick.crane
0
137
Member Avatar for judithSampathwa

[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 …

Member Avatar for nick.crane
0
177
Member Avatar for tincho87

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]

Member Avatar for tincho87
0
3K
Member Avatar for Resnymph

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.

Member Avatar for Resnymph
0
144
Member Avatar for benny83

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 …

Member Avatar for nick.crane
0
106
Member Avatar for virusisfound

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]

Member Avatar for hirenpatel53
0
119
Member Avatar for googles_go~

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]

Member Avatar for jonsca
0
138
Member Avatar for judithSampathwa

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: …

Member Avatar for nick.crane
0
98
Member Avatar for SusanHAllen

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 …

Member Avatar for nick.crane
0
198
Member Avatar for NishantG01

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 …

Member Avatar for nick.crane
0
147
Member Avatar for Zinderin

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 …

Member Avatar for Zinderin
0
170
Member Avatar for charqus

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].

Member Avatar for charqus
0
77
Member Avatar for jamshed ahmed

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 …

Member Avatar for nick.crane
0
98
Member Avatar for StaffanB

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.

Member Avatar for nick.crane
0
136
Member Avatar for nssltd

This is the method definition. [iCODE]private void al(String password, string name)[/iCODE] How many parameters (arguments) does it take?

Member Avatar for nick.crane
0
150
Member Avatar for DaveTran

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> …

Member Avatar for DaveTran
1
296
Member Avatar for neo.mn

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 …

Member Avatar for nick.crane
0
112
Member Avatar for Cap'nKirk

C# is case sensitive! [iCODE]IsConnected != isConnected[/iCODE]. Look at your code again. [Edit] @farooqaaa: Maybe you should edit your blog post!

Member Avatar for farooqaaa
0
195
Member Avatar for empyrean

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 …

Member Avatar for nick.crane
0
146
Member Avatar for judithSampathwa

[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 …

Member Avatar for Duki
0
285
Member Avatar for judithSampathwa

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 …

Member Avatar for Duki
0
131
Member Avatar for judithSampathwa

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 …

Member Avatar for nick.crane
0
438
Member Avatar for GAME

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.

Member Avatar for nick.crane
0
157
Member Avatar for DustinS

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.

Member Avatar for DustinS
0
211
Member Avatar for judithSampathwa

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 …

Member Avatar for rupeshbari
-2
270
Member Avatar for virusisfound

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 …

Member Avatar for virusisfound
0
97
Member Avatar for MrBlack

You neeed to close the filestream in form1. [Edit] As it is now it will only close when the GC disposes of the filestream.

Member Avatar for MrBlack
0
128
Member Avatar for Hardz

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"); // …

Member Avatar for Hardz
0
360
Member Avatar for darkocean

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.

Member Avatar for darkocean
0
122
Member Avatar for darkocean

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 …

Member Avatar for darkocean
0
2K
Member Avatar for virusisfound

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]"?

Member Avatar for nick.crane
0
139
Member Avatar for MARKAND911

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 …

Member Avatar for nick.crane
0
2K
Member Avatar for virusisfound

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.

Member Avatar for virusisfound
0
710
Member Avatar for Acidburn

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]

Member Avatar for nick.crane
0
214
Member Avatar for Nfurman

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.).

Member Avatar for Lusiphur
0
95
Member Avatar for judithSampathwa

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 …

Member Avatar for nick.crane
0
144
Member Avatar for dczen

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 …

Member Avatar for dczen
0
1K
Member Avatar for octavia

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 …

Member Avatar for Lusiphur
0
406
Member Avatar for GAME

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 …

Member Avatar for nick.crane
0
145
Member Avatar for mssarwer

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.

Member Avatar for nick.crane
0
8K
Member Avatar for StaffanB

Try [iCODE]richTextBox1.Select(charPos, 0);[/iCODE] to move the cursor to after the charPos'th character.

Member Avatar for nick.crane
0
161
Member Avatar for sadhawan

The error probably means your xml file is missing some required declaration at the begining. Can you show some code and the xml file.

Member Avatar for nick.crane
0
593
Member Avatar for Mattisc

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]

Member Avatar for Mattisc
0
558
Member Avatar for virusisfound

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 …

Member Avatar for nick.crane
0
139

The End.