|
Thank you for both answers.
This was the approach I choose. It works perfectly
|
|
|
|
|
hello ,
i am trying to save the PageSettings ,
from a PageSetupDialog form because , i want the user to select
a page size and margin sizes one time then by the next time that he will print the same document the sizes he chose will show as default on the
PageSetupDialog.
i have tried to do this with Properties saving the PageSettings in ....
Properties.Settings.Default.sticker_page_settings,
and after creating a PageSetupDialog psd = new PageSetupDialog();
i wrote something like:
psd.PageSettings = Properties.Settings.Default.sticker_page_settings,
but still , the PageSetupDialog displays the same default values.
any tips or answers are welcome , thanks evryone
Net
|
|
|
|
|
I need the C# code snipset to establish a connection with a database [LabourData.mdf] created from SQL Server 2005.
've used this but the connection was not effective:
public string conet()
{
return "server=.;initial catalog=LabourData;uid=sa;pwd=solutions!"
}
Note: Am new to SQL Server 2005
Thanks
|
|
|
|
|
|
I need the C# code snipset to establish a connection with a database [LabourData.mdf] created from SQL Server 2005.
Note: Am new to SQL Server 2005
Thanks
|
|
|
|
|
there are so so many articles here on CP and this issue has been discussed a lot many time...
please LURK BEFORE U LEEP!
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
my problem is most of my project winfrm/webfrm (C#.net) takes too much time to start and to operate.
do you think I have to change my programming style.
if you have any thing to say about it or have any sample project to study on
PLEASE fell free to mail me
at :- hptaunk@gmail.com
I will be very glad to you.
thanks
himanshu p.taunk
|
|
|
|
|
How long is too long ? What does your app do on startup ?
The .NET framework takes a while to initialise, a web app especially, will take a long time to start on first access, then be nice and fast.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
himanshu p taunk wrote: my problem is most of my project winfrm/webfrm (C#.net) takes too much time to start and to operate.
I have no idea what this means!
himanshu p taunk wrote: do you think I have to change my programming style.
Being that you have not hinted at what your current "programming style" is, how is anyone supposed to advise you on whether to change?
himanshu p taunk wrote: if you have any thing to say about it or have any sample project to study on
There are thousands upon thousands of C# projects redily available on the net to study how others program things.... any reason why you need someone else to do the google search for you?
himanshu p taunk wrote: PLEASE fell free to mail me
The general idea of forums is that they are public and everyone gets to learn... by mailing you directly this is not possible. Post a message to a forum get a response on the forum... thats the way we play this game.
|
|
|
|
|
my mistake
sorry
most of my program takes too much time to connect a database (SQL Express /MS Access) making my application to response slow.
i access my database using a class
where i have declare my statements
(currently i am working on vb Project)
this is the code i usto access to database
do u find any problem with it
''''''
Imports System
Imports System.Data
Imports System.Data.OleDb
Public Class dbtask
Public Sub New()
End Sub
Public ReadOnly Property Connection() As OleDbConnection
Get
Try
Return New OleDbConnection(Configuration.ConfigurationManager.AppSettings(0).ToString())
Catch ex As Exception
Throw New Exception("OleDbConnection : " & ex.Message)
End Try
End Get
End Property
Public Function ExecuteCommand(ByVal statement As String) As DataTable
Try
Dim adp As New OleDbDataAdapter(statement, Connection())
Dim ds As New DataSet
ds.Clear()
adp.Fill(ds)
' MsgBox("-->" & ds.Tables.Count)
Return ds.Tables(0)
Catch ex As Exception
Connection.Close()
'Throw New Exception("Oledb Execute Command : " & ex.Message)
Return Nothing
End Try
End Function
Public Sub ExecuteNonCommand(ByVal statement As String)
Dim cmd As New OleDbCommand(statement, Connection())
Try
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
Catch ex As Exception
cmd.Connection.Close()
Throw New Exception("Oledb Execute Non Command : " & ex.Message)
End Try
End Sub
End Class
himanshu p.taunk
|
|
|
|
|
First thing!!
look at the name of the forum and the code u've posted? See anything??
and well incase if your applications are taking time to initialize things... you should consider using a splash Screen at the start just like MS word has. and do ur initializations on another thread while the window is there. There are a few articles here as well... search for it.
Thanks
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
That code is not very good. You are opening a new database connection for every single query you run, which is just a waste of resources.
Even worse, the ExecuteCommand method opens a connection that is never closed. Only if there was an exception the code closes a connection, but that is not the connection that was open earlier. Instead it opens a completely new connection that is immediately closed.
The ExecuteCommand is bad in another way. It catches any type of exception, discards it and just return an unusable value. If you catch exceptions, only catch the ones that you handle, and really handle the ones that you catch.
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote:
That code is not very good. You are opening a new database connection for every single query you run, which is just a waste of resources.
Connection pooling should take care of that.
|
|
|
|
|
Connection pooling helps a lot, but it's still a waste of resources to open and close connections over and over again.
Besides, if you don't close the connections, even the pooling can't save you.
---
single minded; short sighted; long gone;
|
|
|
|
|
what changes you want me to do, to make it work well
himanshu p.taunk
|
|
|
|
|
I need the C# codes snipset to establish a connection to a database [Club.mdf] created using SQlExpress bundled with visual studio.net 2005.
Note: Am handling a web project.
Thanks
|
|
|
|
|
SqlConnection con = new SqlConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\club.mdf");
using this statement u can connect to your club.mdf database
himanshu p.taunk
|
|
|
|
|
Example:
if a end user select time in dropdown according to that the alert to be Popup
somasekaran.M.C
|
|
|
|
|
Use timers to poll the value of DateTime.Now and when it's past your alarm time, show the alarm.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
If you use System.Threading.Timer you don't have to poll. I believe it uses the TimerQueue API
|
|
|
|
|
Hi all, is there a way to set a color to be used for the text and background of a control when its enabled state is set to false?
Thank you!
|
|
|
|
|
hi
look in the Syste.Drawing.SystemBrushes class
regards
|
|
|
|
|
Thank you, but I don't understand: the SystemBrushes doesn't seem to have methods to set System Colors. What I need is to change the disabled text color from grey (I think ControlDark) to Black...
|
|
|
|
|
Hello,
I think he wants to change the SystemBrushes and Colors.
And AFAIK, this is not possible.
All the best,
Martin
|
|
|
|
|
Hi guys. Is there a way to access the mailbox of webmail services like hotmail ? What I need, is a way to get headers of new messages from different webmail accounts. It's all clear with pop3, but I haven't found anything on webmail.
There was an article about 3 years ago here, about how to access hotmail, but it seems hotmail people blocked this way.
Thanks in advance.
|
|
|
|