|
Hello All,
I'm getting a basic Windows application going in C# using Visual Studio 2005 Express and SQL Server Express.
I've created a database (SQL Server Compact) and added a table, a column and some records.
The DB is on my box, XP Home.
I want to populate a ListBox with the four CUST_NAME records in the Form.
Box name: MAXPHOME
SQL Server: SQLEXPRESS
DB Name: OMA1
DB file: OMA1.sdf
Table in DB: CUSTOMER
Columns in CUSTOMER: CUST_PK, CUST_NAME
User Name: none
Password: none
I need a few pieces of code.
1 - DataBase connection string.
2 - Syntax to send the SQL ("SELECT * FROM CUSTOMER").
3 - Databinding the DB return to a windows control (ListBox, DropDown, TextBox) in a Windows Form.
I got some pieces of code from this site, I'm close but, I just can't get it....
Thanks,
Pat G.
|
|
|
|
|
|
pgiambat wrote: 1 - DataBase connection string.
using System.Data.SqlClient;
...
SqlConnection oSQLConn = new SqlConnection();
oSQLConn.ConnectionString = "Data Source=(local);" +
"Initial Catalog=mySQLServerDBName;" +
"Integrated Security=SSPI";
oSQLConn.Open();
pgiambat wrote: 2 - Syntax to send the SQL ("SELECT * FROM CUSTOMER").
Yes that is correct.
pgiambat wrote: 3 - Databinding the DB return to a windows control (ListBox, DropDown, TextBox) in a Windows Form.
Get it[^]
Regards,
Satips.
|
|
|
|
|
Satips wrote: ...oSQLConn.ConnectionString = "Data Source=(local);..." +
This won't work.
You missed the part about SQL Server Compact Edition.
only two letters away from being an asset
|
|
|
|
|
Howdy fellow geeks,
This is just a sort of general C# question that doesn't really require a solution as there's many ways to work around, I'm just wondering.
Is it possible in C# (.NET 2.0) to define a get/set for a property with different access modifier for the get and the set.
That is, something like that:
private string _Prop;
public string Prop
{
get
{
return _Prop;
}
}
protected string Prop
{
set
{
_Prop=value;
}
}
Obviously that doesn't work or I wouldn't ask the question but maybe there's a different syntax to do so.. is there?
(while retaining the neatness of get/sets)
Cheers
Ben
|
|
|
|
|
Hope Salil Pitkar here[^] gives a nice explanation for your Question.
Regards,
Satips.
|
|
|
|
|
Well, actually, yes it did, thanks!
The solution is in the comments at the end. Though I think the syntax extension suggested in the article itself is still interesting.
Cheers
Ben
|
|
|
|
|
Glad to help always.
Regards,
Satips.
|
|
|
|
|
I am lokking for an article about micro contoroler?
Please give me some article about it.
thanks
|
|
|
|
|
Hope this[^] may Help you.
Regards,
Satips.
|
|
|
|
|
Does anyone know where I could find some good documentation on the WAV file format? A lot of what I've found is sort of hard to understand.
P.S. Sorry if this isn't the right board to post this question; I couldn't find a specific board related to file formats, audio, etc, and I usually ask questions here, so...
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
|
I have a main window application, mainForm.
At some point, I create an auxhiliary window, auxWin.
For auxWin, rather than disposing the object when user closes the window (clicks the x in top right), I want to hide the object instead (and simply show it when the user opens it again).
I kind of got close by intercepting the FormClosing event with the following:
<br />
<br />
private void CatchFormClose(object sender, FormClosingEventArgs e)<br />
{<br />
this.Hide();<br />
e.Cancel = true;<br />
<br />
}<br />
<br />
where e.Cancel stops the system from disposing the window.
This works fine, but the problem comes in when I try to close the main application, mainForm - it now 'hides' it too! (in effect nothing happens, which is bad since I want it to close!). I put a breakpoint at this.Hide() and it gets called which is surprising (even though this event-handling method is in auxForm ??). I have tried doing a check with:
<br />
if(sender.GetType() == typeof(auxForm))<br />
but this doesn't work - it ALWAYS thinks its the auxForm that raised the event.
Am I going about this the right way? If someone could point me in the direction of how windows forms (and their opening and closing, without disposing objects - which I understand is bad for memory usage too) are managed I'd greatly appreciate it!
Many thanks,
Gerry
Forms newbie
|
|
|
|
|
Hello,
Sounds strange to me!
I think you have to show some more code.
All the best,
Martin
|
|
|
|
|
Thanks for your response Martin...
Which part of the code don't you understand?
It basically comes down to how does one hide a form (ie. override the Close() / Dispose() method) yet keep the main form reactive to closeForm events ??
Regards,
Gerry
|
|
|
|
|
Hello,
I did understand what you meant!
As I said "It sounds strange to me", I meant the behaviour you discriped.
So I'm thinking there must be something else wrong.
Maybe seeing the code helps us, to help you better.
All the best,
Martin
|
|
|
|
|
I've created an application for logging various events in an RTF textbox with lots of formatted text and graphics etc.
Now I'd like to be able to print the contents.
But! I can't find any simple way to do this...
One solution I've found saves the contents to disk as a .rtf document and then gets wordpad to print it. This works and produces very nice output - however wordpad doesn't support headers and footers and I really need to add date and timestamps plus page numbers to the bottom of each page.
Does anyone know of a simple way, or a good resource which describes how to print the contents of an RTF textbox?
Many thanks for your kind help.
John.
|
|
|
|
|
Take a look here[^] for a start.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Mav,
Very cool article - just what I need methinks.
I'm going to have to read it a couple of times to make sure I understand it though!
Many thanks.
John.
|
|
|
|
|
hi
i need a DataGridView with footer, but i don't found on the net, can any one help me ?
thanks
|
|
|
|
|
Hi,
If you Want To Add Footer in DataGridView, For that one method may be
loop through the available rows and add the values and displaye them like
double amount=0;
int i=0;
for(i=0; i< dgv.rows.count-1;i++)
{
amount+=Convert.ToDouble(dgv.rows[i].cells[0].ToString());
}
dgv.Rows.Add();
dgv.Rows[i+1].Cells[0].Value=amount.ToString();
Hope This Hepls
Regards
Pankaj Joshi
|
|
|
|
|
Hello,
I am using this library in one of my project : http://www.codeproject.com/cs/miscctrl/SyntaxHighlighting.asp[^]
This is how i used it in my editor i've been working on:
<br />
shtb = new SyntaxHighlightingTextBox();<br />
shtb.Name = "shtb";<br />
shtb.Location = new Point(0, 0);<br />
shtb.Dock = DockStyle.Fill;<br />
shtb.WordWrap = false;<br />
shtb.ScrollBars = RichTextBoxScrollBars.Both;<br />
shtb.FilterAutoComplete = false;<br />
shtb.AcceptsTab = true;<br />
shtb.DetectUrls = false;<br />
shtb.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));<br />
<br />
<br />
shtb.Seperators.Add(' ');<br />
shtb.Seperators.Add('\r');<br />
shtb.Seperators.Add('\n');<br />
shtb.Seperators.Add('\t');<br />
shtb.Seperators.Add(',');<br />
shtb.Seperators.Add('.');<br />
shtb.Seperators.Add('-');<br />
shtb.Seperators.Add('+');<br />
<br />
<br />
shtb.ContextMenuStrip = EditorContextMenu;<br />
Controls.Add(shtb);<br />
this.Controls.Add(this.MainMenu);<br />
<br />
<br />
try<br />
{<br />
TextReader syntax_blue = new StreamReader("synHighLib_DB/blue.txt");<br />
string line = syntax_blue.ReadLine();<br />
while (line != null)<br />
{<br />
shtb.HighlightDescriptors.Add(new HighlightDescriptor(line, Color.Blue, null, DescriptorType.Word, DescriptorRecognition.WholeWord, true));<br />
line = syntax_blue.ReadLine();<br />
}<br />
syntax_blue.Close();<br />
}<br />
catch (Exception e)<br />
{<br />
MessageBox.Show("Exception Error : " + e.Message, "eAthena Script Editor");<br />
}
This is the contents of my blue.txt db file
0<br />
1<br />
2<br />
3<br />
4<br />
5<br />
6<br />
7<br />
8<br />
9
As you can see, i want to turn all interger that the user types in the editor into blue color. When i tried this in the compiled app, this is how it looks like:
http://img254.imageshack.us/img254/9892/untitledog4.png[^]
How do you set it up so that as you type all the defined syntax in the blue.txt db file turns blue? e.g. 123456 (as i type, it shud be blue)
|
|
|
|
|
Same with having everything inside " and " brown, i did this:
shtb.HighlightDescriptors.Add(new HighlightDescriptor("\"", "\"", Color.Brown, null, DescriptorType.ToCloseToken, DescriptorRecognition.StartsWith, false));
I compiled the app and tried to type like this "hello" and only once the first double quote became brown and then as soon as i typed the h, it stopped being brown.
Where im i going wrong? how can i get this right?
Thanks in advance for any help you can offer
|
|
|
|
|
|
Some of you may remember this post[^] from 2 months ago where I tried to figure out why after such great interviews I was passed over for the position. You were all very supportive and enouraging. Your suggestions were very helpful.
Well, today I'd like to follow up on that story. Some of you suggested that I should ask the interviewer for feedback about the code sample I had submitted. Well I did, and we emailed back and forth a couple times until I got the feedback I was after.
The feedback was that the program was written as a structured program and lacking extensive error handling. He had expected the program to be written in OOP, with more comprehensive error handling, logging capability and that I should have used the project as an opportunity to "show off".
I gladly followed his suggestions, rewrote the project and resubmitted it to him. After reviewing version 2, he suggested that minus the unit testing (which we had agreed would be omitted) it was a "technical tour de force".
Soon after I was contacted by 2 project teams from the same company (one was led by my interviewer) and asked if I was still available and interested in a position with the company. I had only just accepted a position with another company as a software consultant and so I declined the offers with the agreement to keep in touch and revisit the possibility in the near future.
I've taken home a couple lessons from this I'd like to share:
- Always put your best foot forward. Do your best work, submit your best answers and don't be afraid to take your time doing it.
- Read between the lines. I was asked several OOP questions by each interviewer (I had 3 separate interviews with this company).
- Don't give up, and don't take no for an answer!! If you want the job and you know you're qualified, you can demonstrate some great qualities as long as you're not a pest about it.
- Even if you don't get the job you can come away with something. Ask your interviewer for feedback. If you ask right, they'll be happy to tell you where you fell short and how you could improve for the next interview (wither it's with them or someone else).
Add your own comments and tell me what you think. I hope to write an article about this whole experience and would be interested to hear your feedback on my whole experience.
For those who are interested here are the two versions of the project I submitted:
Version 1.0
Version 2.0
|
|
|
|