|
Jun Du wrote: A better design would be adding Property to Form1. Outsiders access Form1 properties and Form1 binds these properties with its own controls.
Not much better, a better design would use MVC Pattern.
|
|
|
|
|
Hello alll
I need to find 24 Hrs back DateTime using C#. How to do this.
regards
GV Ramana
regards
GV Ramana
|
|
|
|
|
DateTime back = DateTime.Now.Subtract(new TimeSpan(24, 0, 0));
|
|
|
|
|
May be a little ugly but:
System.DateTime dtYesterday;<br />
dtYesterday = System.DateTime.Now.AddHours(-24);
|
|
|
|
|
Not ugly at all. The method accepts negative values becase you are supposed to use them.
---
b { font-weight: normal; }
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
Hello!
When I try to execute a program sometimes it doesn´t work, and if I stop the debug the program that I wanted to be executed initializes =/. It really annoys me!!
What is happening?
Process.Start(ProgrammePfad, AuftragsVerzeichnis);
or
Process p = new Process();<br />
ProcessStartInfo startInfo = new ProcessStartInfo();<br />
startInfo.FileName = ProgrammePfad;
startInfo.Arguments = AuftragsVerzeichnis;
startInfo.ErrorDialog = true;<br />
startInfo.WindowStyle = ProcessWindowStyle.Normal;<br />
<br />
<br />
p.StartInfo = startInfo;<br />
p.Start();
Both of them sometimes work, sometimes don´t! =/
The program that I want to be executed is called InTouch WindowMaker.
Thanks!
Regards
|
|
|
|
|
suguimoto wrote: When I try to execute a program sometimes it doesn´t work,
Are you trying to communicate with the program that you try to execute? If not, what exactly does "it doesn't work" mean?
You could try calling WaitForInputIdle[^] right after starting the process and see if it helps.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi
I am creasting an application where I am implementing "search and replace word" functionality. I have a dialog "SearchAndReplace" which takes two text inputs and has three buttons as "FindNext", "Replace" and "Close"
I have implemented following code in my main form:
My main class code is:
<br />
if (SearchReplaceDialog.ShowDialog() == DialogResult.OK)<br />
{<br />
if (SearchReplaceDialog.WithReplace)<br />
{<br />
int c = this.Editor.Replace(SearchReplaceDialog.Search, SearchReplaceDialog.Replace, SearchReplaceDialog.Match, SearchReplaceDialog.Word, SearchReplaceDialog.Up);<br />
MessageBox.Show(c.ToString() + " strings found and replaced");<br />
} <br />
else <br />
{<br />
bool r = this.htmlEditor1.Find(SearchReplaceDialog.Search, SearchReplaceDialog.Match, SearchReplaceDialog.Word, SearchReplaceDialog.Up);<br />
if (!r)<br />
{<br />
MessageBox.Show("String '"+SearchReplaceDialog.Search+"' not found");<br />
}<br />
}<br />
}<br />
SearchDialog code:
<br />
private void btnFindNext_Click(object sender, System.EventArgs e)<br />
{<br />
Match = this.chbMatchCase.Checked;<br />
Word = this.chbMatchWholeWord.Checked;<br />
Up = this.chbSearchUpward.Checked;<br />
Search = this.txtFindWhat.Text;<br />
Replace = this.txtReplaceWith.Text = String.Empty;<br />
WithReplace = false;<br />
<br />
DialogResult = DialogResult.OK;<br />
}<br />
When I click Find Next, the Search and replace dialog box closes. I want to retain it on top of application and close the dialog when user closes it on Clicking "Close" button.
Can anyone please suggest my how can I achieve this?
Thanks
|
|
|
|
|
Set the property "DialogResult" to "None" for "FindNext" Button.
|
|
|
|
|
As stancrm me eluded, setting DialogResult to DialogResult.OK is what's closing the form. As he suggested, you can set it to DialogResult.None, or don't set it at all on Find Next.
Your question gave the impression that you also need help getting information from the dialog form. You could have it publish events to notify the using form of the information in a match on Find Next, which would help you accomplish that.
Try code model generation tools at BoneSoft.com.
|
|
|
|
|
I would like to ask user name and password when accessing to database with login prompt but seems that there doesn't exist the same mechanisn than eg. earlier VB connection object. (like connection.Properties("PROMPT") = adPromptComplete)
This kind of login form would be useful especially in situation when I get default connectionstring with Integrated Security=SSPI and that doesn't work...
C# connection object doesn't have properties property??
-- modified at 8:35 Wednesday 5th July, 2006
|
|
|
|
|
jaskatpl wrote: This kind of login form would be useful especially in situation when I get default connectionstring with Integrated Security=SSPI and that doesn't work...
This is not a "default" connection. It means you connect using the rights associated with the security context the calling application is running within. Typically, for a windows application, this will be the account you logged on with.
jaskatpl wrote: C# connection object doesn't have properties property??
C# is a language, the .NET Framework has a number of connection classes. I'm assuming you are referring to SqlConnection. You can set the connection string to contain a username and password if you want. All you have to do then is to create a dialog to accept a username and password and use that when you are building a connection string.
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
|
|
|
|
|
Ok.. sorry about some inaccuraties but let's say that I have my default connnectionstring in my specific application. Now my "default" connectionstring have keyword Integrated Security with value SSPI and I test connection when I am contsructing object from my DataAccesLayer. The test fail and I want to use eg. sql server autentication with used id and password as "backdoor". There have been "automatic" mechanism for this earlier and now I'm wondering why it doesn't exist(or I simply could't find it)
Colin Angus Mackay wrote: All you have to do then is to create a dialog to accept a username and password and use that when you are building a connection string.
Yes.. exaclty. It's very easy but I still would like to find some other way ...
|
|
|
|
|
jaskatpl wrote: Now my "default" connectionstring have keyword Integrated Security with value SSPI and I test connection when I am contsructing object from my DataAccesLayer. The test fail and I want to use eg. sql server autentication with used id and password as "backdoor".
Then you need to supply different connection strings for different scenarios. "Backdoors" are a form of security violation and I trust that you didn't really mean "backdoor" in that sense. You can put the connection string in to the app.config and when you are running your application in side the test framework (I use NUnit) you can supply a different config file. For example, if you open a test assembly in NUnit it will pull in an app config file with called assemblyname.dll.config
jaskatpl wrote: There have been "automatic" mechanism for this earlier
There has, to my knowledge, never been an automatic mechanism for this.
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
|
|
|
|
|
->backdoor
I'm not very familiar yet with these english terms so thanks for correcting.
I have always just one connectionstring that I read from .ini-file and I cannot
change that because there is many other applications that are using the same
value. Sometimes the windows autentication fails and that's why I need sometimes login prompt.
Colin Angus Mackay wrote: There has, to my knowledge, never been an automatic mechanism for this.
What I really mean is this:
http://support.microsoft.com/default.aspx/kb/200886[^]
Old ADO supports this but I haven't found it from ADO.NET...
-- modified at 2:00 Thursday 6th July, 2006
|
|
|
|
|
|
Colin Angus Mackay wrote: ADO.NET isn't a continuation of the old ADO. The only thing that is shared between the two is part of the name.
some people have an other opinion:
-> There are a number of similarities between ADO.NET programming
-> and ADO (not only the name), so upgrading from ADO shouldn't be too
-> difficult.
http://www.stardeveloper.com/articles/display.html?article=2002042001&page=1[^]
but ok, I don't want to argue with that. The result is that I have to code the login prompt myself.
|
|
|
|
|
|
Hi everyone....
Can anyone tell me if its possible to autosearch a datagrid if the user starts typing on it ?
For example if the user starts typing in a Code field, the datagrid must go to the first location equal to the character pressed etc. until a code is found. Keypressed property ?? Please need help !
|
|
|
|
|
Are you talking about a winform or asp.net app?
If it's winform, you should be able to subscribe to the keydown (or keyup) event. Look at the args to the event and then set the selected index in your grid to whatever row (and whatever column in the row you're talking about) matches the key.
If it's asp.net, you could hook up a javascript function and try to perhaps set a background color on one of the rows. But that will be quite difficult as you will have to interogate the generated table's cell values (innertext i think) and then set a background color on the row with the matching value.
Another way to go might be to put a text box up above the grid and a button beside it that says something like 'find'. Let them type a text fragment into the box and then use the button's event to search the grid contents.
|
|
|
|
|
Yes im talking about a windows form. I did the textbox and button thing but i want as less buttons as possible. Im trying the keydown event ... but having some trouble with it. The datagrid wants to refresh and get the data from the dataset again but i just want it to scroll down to the letter, letters or word ...
|
|
|
|
|
Probably not exactly what you are looking for but I wrote an article which filters the DataGrid. You can find it here[^].
|
|
|
|
|
Something like that , just without the testboxes and filter only by one field.
Thanks anyway
|
|
|
|
|
Hi, anyone know how to drag and drop pictures onto the picture box?
I wan to drag others different images onto 1 single image. it works just like neoprints thingy, dragging other decorative images to the picture that we took. Thanks.
|
|
|
|