|
There is a good artical Here
<marquee behavior="alternate">Bo Hunter
|
|
|
|
|
Hi,
I'm amost finished creating my first C# application
My application connects to a database and I want to be able to change the connectionstring without recompiling.
I have read about the app.config file but I'm having problems making i work
Are there anybody who has some tips, examples or useful links?
modified 23-Jul-20 21:01pm.
|
|
|
|
|
Your configuration file should be named application.exe.config. Replace application with the actual executable name. If you add the configuration file to the project then name it app.config and VS.NET will automatically rename it correctly when it builds the project. The file should look like...
<configuration>
<appSettings>
<add key="ConnectionString" value="the actual string goes here" />
</appSettings>
</configuration>
And in code you can access it with...
ConfigurationSettings.AppSettings["ConnectionString"]
|
|
|
|
|
Great... thanks Brian. Now it finally works
modified 23-Jul-20 21:01pm.
|
|
|
|
|
How do I hide those, ideas, links, code appreciated
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Havn't checked, but can this not be done with FormBorderStyle?
|
|
|
|
|
nope only modifying the controlbox but that just greyes out the close button
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
I am using Async Sockets and ThreadPool in order to accept data from a client at high speed. My code works flawlessly on my dev machine XP Pro, and also my Win2K Server test box. However it does not work on the server where it will be running. I have tracked the problem to the function being passed into QueueUserWorkItem not being called.
Has anyone ever come across this or have any idea what might be happening?
Thanks in advance
Andy
Windows 98 (win-doze): a 32 bit Extension to a 16 bit Graphical Shell of an 8 bit Operating System originally coded for a 4 bit Processor by a 2 bit company that can't stand one bit of competition.
|
|
|
|
|
are you running your application from inside your visualstudio IDE ?
try to start from the .net command prompt.
the application i'm writing at the moment (also dealing with sockets and threads) also misbehaves when i start it from inside visualstudio.
don't know why.
andi
|
|
|
|
|
What do you mean by "the function being passed into QueueUserWorkItem not being called"? The program hangs or it "skips" the call, as if it was not made?
If it's the case of hanging, don't forget that the ThreadPool have a limit of 25 threads per processor.
I hope that you have money because it’s necessary to be practical.
And I hope that at least once a year you put some money in front of you and say "you are mine" just to make clear who owns who. - Victor Hugo
|
|
|
|
|
It's ok guys, thanks for the replies. I found out what was happening. Basically a dll that contains a data holding class was apparently the wrong version which I discovered indirectly. Without this other app I would never have discovered the problem due to something catching uncaught exceptions in a C# Windows Service. Here's another one though, does anyone know why uncaught exceptions from a service do get caught somewhere and not logged?
Thanks again guys
Andy
Windows 98 (win-doze): a 32 bit Extension to a 16 bit Graphical Shell of an 8 bit Operating System originally coded for a 4 bit Processor by a 2 bit company that can't stand one bit of competition.
|
|
|
|
|
Hi,
I am trying to build a html in my c# project, which is used for show different tables or joint tables in the database. I don't know how to do that. Can anyone help me?
Thanks in advance!
|
|
|
|
|
I load my default mail clien(Outlook express).I want to put some files in attachment field(Runtime).I cann't understand where is reference to these files.
Process p = new Process();
string toemail = "somebody@server.com";
p.StartInfo = new ProcessStartInfo(@"mailto:"+toemail);
p.StartInfo.UseShellExecute = true;
p.Start();
|
|
|
|
|
Hi there:
I've faced with a silly bug in Menu , I dont know if u had it or not, but I'll be thankful if could help me!
The problem is when u set ur menu Left to Right, & WindowState to Maximized every thing changed!
I mean when menu is Left to Right & windows should start in Maximized mode! even when its normal & the shortcut seted to Maximized!!!
I dont know how I can describe it, so please try it once & look what happend?!
Any help is appreciated!
Always,
Hovik Melkomian.
|
|
|
|
|
Hi,i try to hold a number arraylists in a single main arraylist.But i think because of a referance problem, everytime i add a new arraylist, previous added lists became same with last added one;all items shown as the last arraylist's items.is anyone knows the solution or a different way to hold arraylists?
Thanks
|
|
|
|
|
Array is an object. You are trying something like:
ArrayList a1,a2;
a1=new ArrayList();
a2=new ArrayList();
...
a1.Add(a2);
...
a1.Add(a2); // thesame array
should be:
ArrayList a1,a2;
a1=new ArrayList();
a2=new ArrayList();
...
a1.Add(a2);
a2=new ArrayList();
...
a1.Add(a2); // another array
Hi,
AW
|
|
|
|
|
Thanks but a have already use this.maybe it would be more clear if i send my code
private ArrayList ALMainList=new ArrayList();
private ArrayList ALSendedList;
...
MyArrayList.Add("al1");
CatchSendedList(MyArrayList)
...
MyArrayList.Add("al2");
CatchSendedList(MyArrayList)
...
MyArrayList.Add("al3");
CatchSendedList(MyArrayList)
...
public void CatchSendedList(ArrayList ALSendedL)
{
ALSendedList=new ArrayList();
ALSendedList=ALSendedL;
ALMainList.Add(ALSendedList);
}
when i use this code i take the result:
ALMainList-item0 -> al3
ALMainList-item1 -> al3
ALMainList-item2 -> al3
|
|
|
|
|
You're just copying references around. When you write
ALSendedList=ALSendedL;
you're merely copying the reference to the array list, you are not copying the array list itself. You need to think about copying the items in the array list instead.
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|
... or use CopyTo() method (not Clone())
Hi,
AW
|
|
|
|
|
.NET security sample anyone? There's a good/short article from Code Project by "Manuel Permuy": http://www.codeproject.com/csharp/cryptography.asp
The sample illustrates how to encrypt/decrypt/retrieve certs using WSDK.
QUESTION: I can do all this without WSDK - using just System.Cryptography? I'm new to this and I am looking for nice/short .NET examples (otherwise, i'd be reading MSDN):
1. sign/hash/encrypt data
- both PPK and classic symmetric algo (DES for example).
2. Also want to know how to "publish" your public key so receiver decrypt payload and verify signature (in your sample, client and receiver on same machine/process.) So, am I talking about exporting key/key blob? A handle to a key is meaningless on a remote machine.
3. retrieve certificates from cert stores (covered in this article)
4. add cert (makecert.exe or MMC/3rd party: I'm alrite with this.)
Any good articles? I want to do this all .NET - but as you mentioned, you don't get .NET support in dealing with cert stores. Is that still true?
Thanks.
norm
|
|
|
|
|
I try to send mail to the oher server ,but I cann't send it.Every time when I try, I have this kind of exception: Could not access 'CDO.Message' object.
I am sure that I had installed and runing SMTP service and CDO.
MailMessage mailMessage = null;
MailAttachment mailAttachment = null;
//GetMessageInfo(mailMessage);
mailMessage = new MailMessage();
mailMessage.From = textBoxFrom.Text;
mailMessage.To = textBoxTo.Text;
mailMessage.Subject = textBoxSubject.Text;
mailMessage.Body = textBoxMessage.Text;
//GetMessageAttachment(mailAttachment,mailMessage);
if(textBoxAttachment.Text != "")
{
if(File.Exists(textBoxAttachment.Text))
{
mailAttachment = new MailAttachment(textBoxAttachment.Text, MailEncoding.Base64);
mailMessage.Attachments.Add(mailAttachment);
}
else
{
MessageBox.Show("The file do not exist");
}
}
SmtpMail.SmtpServer.Insert(0,"mail.yahoo.com");
SmtpMail.SmtpServer = "mail.yahoo.com";
mailMessage.BodyFormat = MailFormat.Text;
SmtpMail.Send(mailMessage);
MessageBox.Show("Done");
|
|
|
|
|
There are twp possible reasons:
1. mail.yahoo.com cannot be found
2. mail.yahoo.com does not accept your email. Maybe your not logged in.
Catch the exception and check the inner exceptions, mostly they are more informative.
|
|
|
|
|
I'm trying to write a game in C# to learn the language.
It's a mini clone of civilization III.
The main game window is a map, drawn with tiles (20x20 tiles right now).
To draw the map, I have somewhere a Bitmap that I store as backbuffer, where I draw the tiles themselves. Then to animate the sprites I use this "map bitmap", and draw the sprites above it.
To draw a tile, I have canvas in memory, with all the braw bitmaps (they contains 9x9 tiles), I select the right tile (-> creation of a source rectangle, corresponding to the right tile in the canvas), then I draw it in my Bitmap, after having found the destination rectangle.
So basically it's something like
graphics.Draw(CanvasBitmap, SourceRectangle, DestinationRectangle).
I have some problem with speed : rendering 20x20 tiles (each is 128x64) takes 950 ms. As I need to render it anytime I scroll (because the map is 200x200, but the viewport is only 20x20), it is not acceptable.
Is there a way to speed the process using only GDI+ and C#?
Must I use direct X?
|
|
|
|
|
Try this approach:
Choose the graphics surface of a PictureBox control instead of drawing on a Bitmap object, I mean do your drawing in OnPaint event of PictureBox control(and use e.Graphics ). This way you can use benefits of auto scrolling that PictureBox control has. And also speed is more acceptable than when you draw on a Bitmap object.
I hope this helps
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
I can' do this, because I want to precalculate the map backgrounds only when the user wants to scroll. Then moving sprites on the map doesn't need any change in the map itself, so I will use the precalculated bitmap.
|
|
|
|