291 Posted Topics

Member Avatar for functionalCode

DataRow[] rows = yourTable.Select(string.Format("ID='{0}'",cbIDs.Text)); yourLabel.Text = (string)rows[0]["Name"];

Member Avatar for functionalCode
0
186
Member Avatar for Poojasrivastava
Member Avatar for Jx_Man

Jugortha has given you the way to get the the current cell into a text box. Have you looked at just binding the Textbox (and other) components to the same BindingSource as the DataGridView... then let the great binding capabiliites handle populating all the controls for you.

Member Avatar for lksath
0
351
Member Avatar for Yellowdog428

[code] DataTable tbl = new DataTable(); SqlDataAdapter adapt = new SqlDataAdapter(string.Format("select cust_address,customer_city from customers where customer_id = {0}", customerID), con); adapt.Fill(tbl); if (tbl.Rows.Count > 0) { lblAddress1.Text = (string)tbl.Rows[0]["cust_address"]; lblCity.Text = (string)tbl.Rows[0]["customer_city"]; } tbl.Dispose(); [/code] Just one of many ways of doing this.

Member Avatar for JerryShaw
0
143
Member Avatar for JackDurden

To use the select, try this: [code] DataRow[] rows = table.Select("[First]='Lance'"); if(rows.Length > 0) { Console.Write("{0} ", rows[0]["ID"]); Console.Write("{0} ", rows[0]["FIRST"]); Console.Write("{0} ", row[0]["AGE"]); Console.WriteLine(); } [/code] // Jerry

Member Avatar for flavioweb1
0
278
Member Avatar for petya.ivanova

Maybe posting the rest of the code (or entire project) will help. The adapter.table is a bit of a mystery. The acceptchanges is not really needed until later after the rows have all been added. I think the use of the adapter object in the for loop may be at …

Member Avatar for petya.ivanova
0
158
Member Avatar for hi.meral

If you are referring to licensing the software application on the target machine, you may want to checkout this website: [url]http://www.eziriz.com/intellilock.htm[/url] I use this product, and it is very nice, plus it will prevent others from reverse engineering it. The target machine will need dot net, and you can put …

Member Avatar for papanyquiL
0
131
Member Avatar for honeybits

honeybits, Let me apologize for my colleague’s answers. Often times it is easy to forget that this forum has many students and new-bees. Do not let them discourage you from asking questions here. [code] static void Main(string[] args) { string _countStart; string _countEnd; string _oddEven; int _iStart; int _iEnd; string …

Member Avatar for efficacious
0
133
Member Avatar for Bramenator

try making the class static as well: public static class GlobalVariables

Member Avatar for swain
0
178
Member Avatar for shazzy99

Place an Applicaiton.DoEvents(); inside of the loop so that the main thread has a chance to service its message queue and this should allow your label to update. // Jerry

Member Avatar for shazzy99
0
120
Member Avatar for MJV

estimatorDataSet.QuoteCalcHeader["estimateno"]. <<== is estimateno correct ? does the QuoteCalcHeader accept a string as the indexer ? What is QuoteCalcHeader ? (Type?) You can ignore the code below, I think your problem is with indexing that QuoteCalcHeader object, but the formatting below might help you after resolving that issue, so I …

Member Avatar for JerryShaw
0
134
Member Avatar for geossl

Why do you think this is an error. Your timer is on a 1000 ms loop, and the TryEnter has a max wait time of 1ms. It should always return true, because there was nothing preventing it (IOW nothing else locking the object for more than 1001ms. Try having another …

Member Avatar for JerryShaw
0
140
Member Avatar for dip7
Member Avatar for JerryShaw
0
99
Member Avatar for toadzky

Are you saying that when you change rows, you want to know how to set the radio buttons to have the correct one checked ? The BindingSource has an event for position change. Setup a BindingSource for this table, and attach an event handler to its PositionChanged event. // Jerry

Member Avatar for JerryShaw
0
121
Member Avatar for jonnytabpni

Have you checked your reference properties for the DLL, and make sure it is not set to version specific ?

Member Avatar for JerryShaw
0
165
Member Avatar for finnj6

Make sure your DateTime value is enclosed in single quotes. You might find it easier (to read and build) if you assemble the string using the string.Format() method. [code] SqlConnection conn = new SqlConnection(); SqlDateTime sTime = new SqlDateTime(DateTime.Now); SqlCommand command = new SqlCommand( string.Format("INSERT INTO Sensors VALUES ('{0}','{1}',{2},'{3}' )" …

Member Avatar for finnj6
0
467
Member Avatar for Mitja Bonca

There is a good example at: [url]http://support.microsoft.com/kb/308507[/url] If this is a clean Select statement to get the data from the databaes, then this works (SqlCommandBuilder). If your data comes from multiple joins you may want to manually post the data back using your own T-SQL code, or a stored procedure. …

Member Avatar for kvprajapati
0
138
Member Avatar for Califer

You can search for C# XPATH on Google for tons of information on this subject. I am not sure you will find exactly what you are looking for. There may be a better alternative, or atleast worth your time to look at, and that is to use the existing power …

Member Avatar for kvprajapati
0
229
Member Avatar for loveforfire33

Maybe this link wil help you understand linked lists. [url]http://www.c-sharpcorner.com/UploadFile/jeradus/UsingLinkedListInCS11102005005525AM/UsingLinkedListInCS.aspx[/url] Too bad they are still teaching these prehistoric methods. Since Generics were introduced, link lists are pretty much useless in the real world. // Jerry

Member Avatar for loveforfire33
0
157
Member Avatar for jonnytabpni

Simple... Just set e.Handled to true When e.Handled is set to true, then the keypress event stops there, otherwise it is passed up the chain to the TextBox. // Jerry

Member Avatar for jonnytabpni
0
336
Member Avatar for gooddevilgod

I may be wrong, but I think you are asking on how to make a static class that all other classes can use. You can change your classGlobal.cs to be static by changing the class definition to public static class classGlobal. You will need to set your public properties and …

Member Avatar for JerryShaw
0
287
Member Avatar for Jarredpsmith

First, you should decide if you are going to use the Wizard created class or stick with your own connection objects. Personnally I hate the wizard created class, it is more trouble than it is worth. Storing the location of the Access data file and the connection string can be …

Member Avatar for kvprajapati
0
99
Member Avatar for sivak

Maybe this link will help [url]http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=1[/url] It includes some C# examples, and reasons for the different type declarations.

Member Avatar for JerryShaw
0
68
Member Avatar for mreynol5

As Scott said, use YourStringVariable.IndexOf("Value to Search") and then use the SubString method to extract what you want.

Member Avatar for ndeniche
0
159
Member Avatar for sivak

External assemblies come in two flavors. Referenced (required at startup), and dynamically loaded at some point when the program wants to use some feature within the external assembly. Dynamically loading and managing assemblies is not automatic. You have to write code to manage these external assemblies. If this isn't very …

Member Avatar for JerryShaw
0
84
Member Avatar for floydus

I have read about this is several books, and it appears that you will need to build a method that will take the array as a parameter, move all the elements except for the one you want to delete and return the new array. Something like this where you want …

Member Avatar for JerryShaw
0
110
Member Avatar for Delija

Something like this: [code] static void Main(string[] args) { string text = "bobby crossed the road and fell on the road"; //File.ReadAllText("C:\\SomeFile.txt"); char[] separator = new char[1] { ' ' }; string[] textData = text.Split(separator, StringSplitOptions.RemoveEmptyEntries); Array.Sort(textData); textData = DoWordCounts(textData); foreach (string str in textData) Console.WriteLine(str.ToLower()); Console.ReadKey(); } private string[] …

Member Avatar for ddanbe
0
490
Member Avatar for zahidprog

Lets first clean up the sql statement so you can easily view it with the debugger and see which item is null... [code] string sql = string.Format("INSERT INTO [Issue] (Sl_no,Date,NamePrdOrRep,NameOfDepartment,TitleOfProduction" +",TapeType,PurposeShooting,PurposePreview,QuantityOfTape,BoxNo,BoxName,TapeNo,IssueOrReturn) " + "Values( '{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}',{8},'{9}','{10}','{11}','{12}' )" ,issue.Sl_no.Replace("'", "''") ,issue.Date ,issue.NamePrdOrRep.Replace("'", "''") ,issue.Department.Replace("'", "''") ,issue.TitleOfProduction.Replace("'", "''") ,issue.TapeType.Replace("'", "''") ,issue.PurposeShooting.Replace("'", "''") ,issue.PurposePreview.Replace("'", …

Member Avatar for neeks
0
109
Member Avatar for swartskaap777

Code Project just got a new Chat project added this week, suggest you check that out. If your chat works on the network, then is should work in the internet as well unless it is just a UDP client. [url]http://www.codeproject.com/KB/miscctrl/SimpleMessenger.aspx[/url]

Member Avatar for Acedia
0
222
Member Avatar for JerryShaw

Hello, I typically hang out in the C# forum, however I hope someone here can help. I am converting a C++ program to C#, and I need to know how to handle a couple things: IOW I know almost nothing about C++, and this code is coming from a non …

Member Avatar for JerryShaw
0
270
Member Avatar for Acidburn

Your interface should have a few more properties, such as the server, database name, credentials. Besides that if may either subclass the writer to handle a Filename in the place of the server. Then in your writeMsg method, you would append the text to the specified filename.

Member Avatar for JerryShaw
0
101
Member Avatar for hi.meral

Check out: [url]http://www.codeproject.com/KB/cs/hard_disk_serialno.aspx[/url] This should get you on the right track. // Jerry

Member Avatar for MosaicFuneral
0
162
Member Avatar for peggyw

What value of time does the integer represent ? Seconds, miliseconds ? You should be able to create a DateTime for the epoch, then add to this the integer in the integer time value as AddSeconds, or AddTicks, etc. to get the value, then as far as displaying it in …

Member Avatar for JerryShaw
0
90
Member Avatar for andy999

Andy, other than a couple small errors, it worked for me. Here is the code I used with corrections: [code] private void savetxt() { // Got rid of "try" because it did not have the rest of it in your sample. //m_stockInfolist is nothing but the listview control name //string[] …

Member Avatar for NguyenThai
0
144
Member Avatar for lyvenice

Not exactly sure what you are asking for, but it is just a string, so you can concat the other textbox values into a single label using the (+) operator. [code] lblResult.Text = txtName.Text + " " + nextTxtName.Text + " "; // and so on... [/code] If this is …

Member Avatar for brainbox
0
2K
Member Avatar for MJV

MJV, Ramy has provided the excepted and standard way to do this. If you are looking for something a little more extreme, then check out : [url]http://www.codeproject.com/KB/combobox/multicolumncombo.aspx[/url] You may also want to explore the abilty to store tons of data to be associated with each combobox item. The item is …

Member Avatar for Ramy Mahrous
0
215
Member Avatar for cmrhema

First I would suggest that you create a constructor for Emp_Details just to make it easier. [code] public Emp_Details( string empName, int empId, double empSalary) { _EmpName = empName; _EmpId = empId; _EmpSalary = empSalary; } [/code] Then as you get information from the user, and want to enter it …

Member Avatar for JerryShaw
0
104
Member Avatar for Tank50

Simple, the first while loop already read through the entire data reader, so there is nothing left to read by the time you get to the last while loop. Seems that you are going about it the hard way. Why not just use an SqlDataAdapter and fill the dtl table. …

Member Avatar for djloser
0
221
Member Avatar for vizy

Looked at some of the links in this thread, and am surprised on how complicated some of these examples tend to be. I use serialization and deserialization with a Binaryformater to store and retrieve class instances between an SQL database and a Windows form. If you need more information on …

Member Avatar for JerryShaw
0
670
Member Avatar for Bladtman242
Member Avatar for konczuras

Similar to Ramey, assuming that the event handler is only assigned to TextBox controls. [code] private void undotextbox(object sender, EventArgs e) { TextBox textbox = sender as TextBox; if(textbox != null) { string oldValue = textbox.Text; } } [/code]

Member Avatar for Ramy Mahrous
0
294
Member Avatar for Doctor Cactus

Try using a switch( var.Length ) construct. That should limit you to ten or so case statements.

Member Avatar for Doctor Cactus
0
78
Member Avatar for shadowolf64

Have you used debug to trace to the actual line that crashes ? I would venture to guess that it is at the line: string isMkv = isMkvTest.Substring(isMkvTest.LastIndexOf(':')); There is no guarantee that isMkvTest is instantiated. Just because you are asking it to readline, does not mean that there is …

Member Avatar for JerryShaw
0
132
Member Avatar for Martin310

try this: [code] double AverageCalc = 0; if (dataGridView1.Rows.Count > 0) { foreach (DataGridViewRow row in datagridview.Rows) { double average; if (double.TryParse(row.Cells[2].Value.ToString(), out average)) AverageCalc += average; } AverageCalc /= datagridview.Rows.Count; } txtAverage.Text = AverageCalc.ToString(); [/code] BTW: You didn't post the error you were getting, only that it is broke

Member Avatar for Martin310
0
510
Member Avatar for JooClops

I don't think you really need to have an array of buttons for this project. Instead set the table to allow drop that way it will allow you to use the drag drop events on the table. Then on the Mouse Move event of the buttons, start a drag operation. …

Member Avatar for JooClops
0
406
Member Avatar for dessolator

Does the text file contain delimiters other than CRLF ? If not, then you will have to consider using line based parsing. Line 0 = CDid Line 1= Artist Etc. If you can post some code, someone (if not me) will come along and give you some feedback. // Jerry

Member Avatar for Acedia
0
134
Member Avatar for BobLewiston

Bob, I take it you are using the Data Source Wizard crap in VS2008. Some people get along with it, but I have been bitten way too many times, and I simply refuse to use it. It has the potential to lose databases, and IMO it is more trouble than …

Member Avatar for JerryShaw
0
82
Member Avatar for Martin310

You can set the Modifier property of the DataGridView in the second dialog box to public. Then if the dialog result is Ok, then you can access the selected row of the DataGridView from your first dialog. Hope this helps // Jerry

Member Avatar for Martin310
0
90
Member Avatar for sivak
Re: sql

Do you mean that your data actually contains the charcter 'K' in the salary value ? (that would be ugly) Assuming that it is true: [code] UPDATE dbo.Employee SET TAX = ( 1.25 * Convert(int,substring(Salary,1,len(Salary)-1) ) WHERE Salary > '30K' [/code] **free handed, so perform some tests on a temp …

Member Avatar for JerryShaw
0
86
Member Avatar for BobLewiston

Is this a duplicate ? I think you posted this earlier, and I sent you some code to use the DataGridView instead of the DataGrid component. // Jerry

Member Avatar for JerryShaw
0
116

The End.