|
Thanks very much. I will try to use the code you gave me.
Here is the reason I came here. I have a "Stock" application. (Inputs, Outputs and Materials).An input contains more materials (1 to many relation). An Output is also a collection of materials. (1 to many again).
To create such an Output I must select from a DataGrid (containing the Materials) those Materials that I need. I do that by means of a CheckBox column.
The Update method of the DataAdapter (that fills the DataSet Materials-Table) should set the value for the Foreign Key in the Materials Table, but only in those that have been checked, and set a boolean value saying that the Material is out of stock since it belongs to an Output (so only 2 fields are Updated).
Nothing fancy. But when the Update method is executed, and by accident I have checked and after that unchecked a row in the DataGrid... surprise: a fuuny error arises
"System.Data.DBConcurrencyException: Concurrency violation: the UpdateCommand affected 0 records"
No multi user environment, no data changed during my DataSet experience to explain the Concurency Error.
Thanks again
|
|
|
|
|
if you create a user control and add a vertical and horizontal scrollbar. You set the tabstop of both scrollbars to false and set the tabstop of the usercontrol to true. If you hit any arrow keys or pageup/down then the scrollbars flash forever. Even if you force the focus back to the usercontrol (which goes back and forth like 9 times till it gives up) then you still have the arrow key stuck to whatever scrollbar you affected first.
what I am trying to figure out is how do you force the scrollbars to %100 ignore the keybaord %100 of the time. I never want the scrollbars to react to the keyboard at all no matter what. However, I want all keys to be handled in the user control. Anyone know how to go about doing this?
|
|
|
|
|
Look into the Autoscroll stuff in .NET. I know it's limited, but it's much easier than trying to make your own scrollable control using scrollbar controls (rather than the built-in window scrollbars).
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
sorry I wasn't clear on my original question. Its not a matter of auto scrolling, its a matter of I need the arrow keys for other things. The fact that scrollbars exist on the usercontrol doesn't mean I want those scrollbars to own the arrow keys.
|
|
|
|
|
how do you make a datagrid catch returns (new paragraphs).
Da Intern
|
|
|
|
|
how do you make a datagrid catch returns.
Da Intern
|
|
|
|
|
What do you want the datagrid to do exactly, if you want to see when the "enter" key is pressed you can use the KeyPress event?
if not write exactly what the app you want to do so we can come up with something!!
From Greece:
Dimitris Iliopoulos
dimilio@yahoo.com
|
|
|
|
|
okay this is what i'm doing im writing a program to make a webpage newsletter i have created a form to input information into a datagrid then i have binded that to xml then use xsl to create the html page but i can't make the information look like a paragraph because the datagrid dosen't read paragraphs as a straight line. also im uploading images to a web server to allow him access to any image on the server......................alot isn't..............if you can help with the two last problems i would greatly appreciate it
Da Intern
|
|
|
|
|
i just want to know how you can a form that you already created in a form that created before.
Da Intern
|
|
|
|
|
Please explain yourself better.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
i have a windows app that runs fine i want to call another app from a menu button i don't know how.................. please help
Da Intern
|
|
|
|
|
If you are wanting to start another process, use Process.Start().
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Process.start() i good if you want to start another app, but you cannot interact with this app after it in an easy way.
You should better create a dll with the functionality from the other program and use it in the new program. .NET remotin is another solution if you want to collabarate with another app. If you want only to start another app use Process.start(), it's the easiest
From Greece:
Dimitris Iliopoulos
dimilio@yahoo.com
|
|
|
|
|
dll im not really famaliar with them so could you help me
Da Intern
|
|
|
|
|
I'm doing some database in C# using MS SQL.
Problem #1:
Everytime i do a connection to my database, i have to copy and paste the code over and over. I heard of a way to put these code in the configuration file, but i don't know how to.
Problem #2:
I also heard of someway(interface, object) allowing me to do SQL query indirectly instead of passing the query string directly into the SqlCommand object. And, again, I don't know how to.
Problem #3:
Is there anyway i can pass in my sql query dynamically(ie, as a varible)?
I just learn C# on my own, and having problem searching for things like this
Please help me out!
THANKS A BUNCH!!!
|
|
|
|
|
You should only need one IDbConnection instance to one database, and you can just reuse it every time (just open and close it).
I am not sure what you mean by indirect query; however I think its good practice to use the interfaces rather than the specific providers as much as possible, as your provider might change. (i.e. IDbCommand cmd = new OldDbCommand("S... ).
As for the queries, I keep mine as strings, not as string literals, and have them in a config file. That way I don't need to recompile every time i change a query. It also makes it easy to add on constraints on the query ( cmd.CommandText = selectString + "WHERE Cust = " + custId.ToString() ).
|
|
|
|
|
FYI,
Problem #1
Where are you connecting from? Are you connecting from a web service? Windows Form? Asp.net?
Problem #2
Problem #3
Read on on the .NET Documentation. Specifically with the SqlCommandBuilder.. It will automatically generate the SQL queries you require.. Its not as fast, to my understanding, as your own
- danny
|
|
|
|
|
Hi,
I have been building my gui's by hand in my most recent project, and have consistently ran into trouble when trying to size controls. I mimic the form designer code with an InitComponent() method that is run from the constructor, where i create all my controls. In this method, when i try sizing the controls through controls such as:
textBox.Size = new Size(100,30);
or:
textBox.Width = 100;
textBox.Height = 30;
the controls will not be sized. Any thoughts on why they are not sizing properly, or is there another way to do it?
Thanks,
Nikolaj Baer
|
|
|
|
|
Hi,
thanks for the advice. Actaully ResizeRedraw is a protected property, something i can't apply to an instance. However, i kept searching, and found that SuspendLayout() and ResumeLayout() is the proper way to do it.
|
|
|
|
|
Hello,
I am building an application that requires data to be entered into a control that looks like the Data Grid. Basically, it should mimic the functionality of entering data into MS Excel. I know the Data Grid is primarily used to display data binded to a data source, such as a DataSet. Is there any way to display a blank data grid and use it for data entry? If not, what do you experts suggest that I do to get the results I'm looking for?
One possible solution that I came up with was to bind the data grid to the table that the data is destined for. Next, I would add one row of text boxes that would represent each column below the grid. The user could then add the record to the data grid (and underlying table) by typing the details into the the textboxes below the grid, followed by clicking the "Add" button. However, a grid will not appear unless there is data in the underlying table to be displayed. The empty data grid control does not look attractive on a form.
I remember building an application in vb 6.0 where I got around this by placing textboxes over the cells of the data grid control. However, I can't remember exactly how I did this, or if it would even work with the .NET data grid control.
Any help would be greatly appreciated
|
|
|
|
|
you can edit on the datagrid directly (datagrid.readonly = false) without using textboxes in the end of it. If you are writing a windows forms app an empty datagrid is ok, in asp.net things are a bit difficult and i think the idea you said with the textboxes is the best.
to be more easy and more attractive your datagrid study
System.windows.datagridtablestyle and System.windows.datagridtextboxcolumn,
To validate them you can use datatable events rowchanged... or use standard techniques Causesvalidation ....
Good luck, to make a datagrid work perfect needs lot of work
From Greece:
Dimitris Iliopoulos
dimilio@yahoo.com
|
|
|
|
|
Hi,
Is it some one out there who could please help me transelate this C# code to VB.NET?
int vPos=(index <= selectedBand) ? buttonHeight*index : buttonHeight*index+selectedBandHeight;
int height=selectedBand==index ? selectedBandHeight+buttonHeight : buttonHeight;
Thanks,
Richard
|
|
|
|
|
<br />
dim vPos as interger<br />
vPos = buttonHeight * index<br />
if index <= selectedBand then<br />
vPos = vPos + selectedBandHeight<br />
end if<br />
<br />
dim height as interger<br />
height = buttonHeight<br />
if selectedBand=index then<br />
height = height + selectedBandHeight<br />
end if<br />
Something like that?
|
|
|
|
|
So in OnStop I create and start a thread with new Thread(new ThreadStart(funk)) , right?
Thread is doing something and then Stop command comes along and naturaly I get OnStop called. Everything is OK so far. I post to my thread a message somehow for it to quit and OnStop returns right away. SCM thinks that everything was ok. But my worker thread has some work to finish before quitting and it may take time. So it continues until it's done BUT magically the service process disappears in about 20 sec after OnStop returned cutting the execution of my thread right in the middle (or so it seems) of a routine.
How do I avoid that? I want that thread to finish normaly.
|
|
|
|
|
You are suggesting to have actual worker code in the main thread of a service? Then how would I responds to OnStart and continue at the same time with out a separate thread? I'm new to this - please advise! Also wouldn't SCM complain about being unable to stop service in "timely fashion" if that main thread works however long it needs?
I want sevrice to report back to SCM I'm done (kindof) but executable would stay until it finishes what it needs.
|
|
|
|