|
Can't you set a picture as the background of a button? and have another picture for the foreground, and text and all that other stuff?
Or is it I that is confused?
|
|
|
|
|
Hello,
I'm using an Access file as a data source but am having problems when it comes to saving to the "database." If I do not "copy the file into the project" it works fine but if I copy it into the project it won't save. I need to get it into the project.
Also, for this project I'm having a little bit of a problem with the SELECT query:
I'm taking a C# entry level course and the book we're using gives this example:
SELECT Bla, BLa, Bla.... FROM dbo.Addresses WHERE LastName = @lastName
I'm trying to do a query exactly like this but it gives me an error:
Error in WHERE clause near '@'. Unable to parse query text.
Using this query:
SELECT PartNumber, PartName, Description, Price, Quantity FROM Invoices WHERE PartNumber = @partNumber
If I ignore the error, the @partNumber parameter doesn't show up in the Adapter window.
Thanks
|
|
|
|
|
I don't understand what you are try to do with the Access file. However, on the web server, you must give ASPNET write accesss in order for ASPNET to INSERT or UPDATE the Accesss file.
The data provider for Access does not support named parameters such as "@lastName". You have to use unnamed parameters using "?":
SELECT * FROM Addresses WHERE LastName = ?
|
|
|
|
|
Is it possible to edit the properties for a file such as the ones that can me found on the summary tab. i.e. author, title, comments, keywords, etc...
thanks.
|
|
|
|
|
Ok, I was just debugging my little web browser app I was creating and before Form1 even loads, I get the litte yellow highlight over this text:
Application.Run(new Form1());
With this message:
"Starting a second message loop on a single thread is not a valid operation. Use Form.ShowDialog instead."
This is in Program.cs, I am new to C# and so do not really understand what the error is, I haven't changed anything in Program.cs atall, just the regular Form.cs
Can somebody please tell me what the hell it is trying to tell me?
Thanks,
Any reply is appreciated.
|
|
|
|
|
Is your Form1 attempting to show another form somewhere using Application.Run() ??
|
|
|
|
|
Not atall, Form1 just contains a textbox and a menustrip so far with a File>New that creates a new instance of a class called File in Text.cs
|
|
|
|
|
Hi,
In my C# Win form (.NET 2.0 - VS 2005), I have 4 datagridviews which are filled by 5 different data tables.
these data tables are directly filled by 5 different SQL Server Everywhere Tables.
Now, Placed all Table Saving Codes within a single method event handler for the save button.
Like this,
private void saveAll()<br />
{<br />
this.Validate();<br />
this.myBindingSource1.EndEdit();<br />
this.myDataSet.MytableAdapter1.Update(.....);<br />
<br />
this.validate();<br />
this.myBindingSource2.EndEdit();<br />
this.myDataSet.MytableAdapter2.Update(.....);<br />
<br />
this.validate();<br />
this.myBindingSource3.EndEdit();<br />
this.myDataSet.MytableAdapter3.Update(.....);<br />
}
Now, When I call the save method, most of the time, I get Error with the message "Concurrency Violation."
Is there any way I can get rid of this problem ?
Thanks in advance,
Emran
|
|
|
|
|
Are any constraints on database children?
|
|
|
|
|
Hi,
Thanks for your reply.
No, My tables are independent, they are not related to any other table as Parent Child and thus there is no question of constraint. Is there any other possibilities for getting rid of this error ?
Regards
Emran
|
|
|
|
|
Your problem is more than likely related to your update commands or identity column
|
|
|
|
|
Thanks for your reply. Right, I have identity column in my tables. But I was wondering the concurrency conflict doesn't occur all the time, but most of the time. I am not sure what to fix in my query or code to get rid of it.
Regards
|
|
|
|
|
how to save a file in c#
Don't wait to hear a word of thanks from anybody when you help them instead ask them to help three other people and ask them to continue in chain.
|
|
|
|
|
SaveFileDialog dlg = new SaveFileDialog();
dlg.Filter = "Text Files|*.txt|Comma Seperated Files|*.csv|All Files|*.*";
dlg.InitialDirectory = @"C:\";
if (dlg.ShowDialog() == DialogResult.OK)
{
using (System.IO.StreamWriter writer = new System.IO.StreamWriter(dlg.FileName))
{
writer.Write(txtContent.Text);
writer.Flush();
}
}
The Filter property is a pipe (vertical bar) separated list of file type descriptions and file type filters that must be paired. So in the above example, when the Save File Dialog is shown, the 'File Types' drop down will contain 3 entries: one for Text Files, which will expect a .txt extension, one for Comma Seperated Values, which will expect a .csv extension, and one for All Files, which will take any extension. The OpenFileDialog class works in the same way.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
Thanks, this has really helped me, codeproject is awesome
|
|
|
|
|
No problem. And yes it is!
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
How do you learn stuff like that, have you got books? If so, can you recommend any good ones?
Thanks.
|
|
|
|
|
Part of it is from books, part of it is from shear experience in the work force. I've been writing software, both Windows and Web for quite a while now, and these are just the sort of things you tend to pick up. Your best bet for learning the framework stuff is to pick an applicaiton, and make your own version of it, simply for the learning experience of how to do it. A notepad clone, with a multi-document interface, toolbars, a status bar, menus, context menus, file opening and saving, and any other features you can think of. Start with small pieces, and work your way up.
You can also jump over to Amazon.com and do a search for Beginning C#. There's a ton of books available, some better than others, so make sure to read the buyer comments before making a purchase.
Also, this site here truly is a wonderful resource, and if you're new to it, you should become as familiar with it as possible. If you can't find what you're looking for in an article, then by all means, post a question in the forum. Just make sure it's the correct forum if you don't want to get flamed. Folks here may not always have the correct answer, but chances are that someone can atleast point you in the right direction.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
Lol ok, thanks mate. A text editor is actually what I am trying to create. Somewhere else in the forum a guy said he needed to make a text editor for a project at a training place or something, so I wanted to see if I was up to it. Thanks for the Save part of it, I'll just try and work out the Open and other stuff part.
Im sure it will be pretty similar.
Thanks.
|
|
|
|
|
Yeah, very similar. The difference is more how it's used than in how it's coded. And again, don't be afraid to ask questions. As long as the questions are like "How do you use the SaveFileDialog control?", and not "Can someone give me the sourcecode for a FTP Program", you'll do fine.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
How do you work out that kind of thing? Have you got books? If so, can you recommend any?
Thanks.
(sorry if this has double posted, something up with my connection)
|
|
|
|
|
You can also follow the simpler code like this if you are using .NET 2.0 (VS 2005)
SaveFileDialog dlg = new SaveFileDialog();<br />
dlg.Filter = "Text Files|*.txt|Comma Seperated Files|*.csv|All Files|*.*";<br />
if (dlg.ShowDialog() == DialogResult.OK)<br />
{<br />
File.WriteAllText(dlg.FileName, txtContent.Text); <br />
}
|
|
|
|
|
Hmm. I've never called this method before. It must call Flush internally. I've had mixed results closing or disposing the StreamWriter class without flushing first.
Thanks for the tip.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
hi,
when use the code given by you it saves a file but unfortunately it saves it without newline characters ie.,. I want to save my work as it is displayed in the multiline text box.can you help me please
Don't wait to hear a word of thanks from anybody when you help them instead ask them to help three other people and ask them to continue in chain.
|
|
|
|
|
Are you writing each line on its own using the StreamWriter.Write method, or are you writing the entire contents of the textbox to the Write method? If you're writing each line on its own, then you need to use WriteLine, not Write.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|