|
I'm developing a windows application in C# usin .NET framework 3.5. Suppose a user opens one form to work. and after working he need to move next page without saving data
if user click the next page i need to give one message like "You May lose unsaved data"
if ok then contine else cancel to stay on the page i don't know where to write code
|
|
|
|
|
Put it either in the button he uses to click to the next page as a message box or on the form close and if you choose not to close handle there. Google is your friend.
|
|
|
|
|
ashajahanmca wrote: if user click the next page
It depends on what 'next page' is. If it is a Control descendant, write your code in the Click event handler.
Give them options for OK and Cancel, if they choose Cancel, just return from the handler before executing the code for next page.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
<asp:Button ID="Button1" runat="server" Text="Add" OnClientClick=" return Test()" onclick="Button1_Click" />
Place it in head section
<script language="javascript" type="text/javascript">
function Test()
{
return confirm("Are u sure");
}
</script>
himanshu
|
|
|
|
|
The OP said it was a Windows Application, although he was talking about pages, so it could be that your reply might be more useful than the others.
I guess we'll never know, unless the ungrateful so-and-so lets us know!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
when I try to parse HTML source code, if I found Scripts by mshtml.HTMLScriptElement
<script>
window.google={kEI:"_Hw3Su_qGZLWwgP5roioDg",kEXPI:"17259,17291",kHL:"en"};
window.google.sn="webhp";window.google.timers={load:{t:{start:(new Date).getTime()}}};try{window.google.pt=window.gtbExternal&&window.gtbExternal.pageT()||window.external&&window.external.pageT}catch(b){}
window.google.jsrt_kill=1;
var _gjwl=location;function _gjuc(){var b=_gjwl.href.indexOf("#");if(b>=0){var a=_gjwl.href.substring(b+1);if(/(^|&)q=/.test(a)&&a.indexOf("#")==-1&&!/(^|&)cad=h($|&)/.test(a)){_gjwl.replace("/search?"+a.replace(/(^|&)fp=[^&]*/g,"")+"&cad=h");return 1}}return 0}function _gjp(){!(window._gjwl.hash&&window._gjuc())&&setTimeout(_gjp,500)};
window._gjp && _gjp();
</script>
How can I access (if I want to change the scripts) this using c#?
|
|
|
|
|
hi..i am doing a project in c#.net.i want to know how i access web services to my project.my project is news management system,and i want add flash news facility through web services.please help me
|
|
|
|
|
Create a web service or get a external web service and add it to your project through "Add a webreference" option. Or you build your own, deploy it in IIS and add a web reference of that. now you can use it.
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
|
I have 2 text files.
input1.txt:
560-005;CORFU_1B;560-005-011
560-005;CORFU_1E;560-005-012
560-005;CORFU_1Z;560-005-013
560-005;CORFU_1H;560-005-014
560-005;SENSE_2B;560-005-021
input2.txt
562-Z21;METAL-ANTHRACITE;562-121-000
562-Z21;METAL-9007;562-221-000
562-Z22;METAL-ANTHRACITE;562-122-000
562-Z22;METAL-9007;562-222-000
public void Conversion()
{
try
{
using (sr1 = new StreamReader("c:\\input1.txt"))
{
using (sr2 = new StreamReader("c:\\input2.txt"))
{
file = new FileStream("c:\\output.txt", FileMode.Create, FileAccess.Write);
sw = new StreamWriter(file);
string line1;
string line2;
while ((line1 = sr1.ReadLine()) != null)
{
string[] temp1 = line1.Split(new char[] { ';' });
while ((line2 = sr2.ReadLine()) != null)
{
string[] temp2 = line2.Split(new char[] { ';' });
string final = temp1[0] + ";" + temp1[1] + ";" + temp1[2] + ";" + temp2[2] + ";" + temp1[2] + "-" + temp2[2];
sw.WriteLine(final);
}
}
}
}
}
finally
{
sr1.Close();
sr2.Close();
sw.Close();
file.Close();
}
}
I have created the above method to do some string management. The problem is that the outer while loops runs only for the first line in input1.txt and I don't know why. It's probably something simple but I can't find the solution.
Thanks...
|
|
|
|
|
Hi,
your code reads each stream once; i.e. for the first line of the first file, the entire content of the second file is read, then everything comes to a halt since sr2 has reached the end-of-stream condition.
if you want to have all combinations of lines from file1 and file2, then you should:
- either open the second file inside the while loop reading file1 (hence reopening it for every line of file1);
- or reposition sr2 at the beginning over and over again.
BTW:
Your try-finally construct will swallow any exception that may occur. I recommend you add catch(Exception exc) {Console.WriteLine(exc.ToString());} to visualize most problems that may (and sooner or later will) occur.
[CORRECTION]Exceptions don't get swallowed by finally blocks, they survive the try-finally construct and will have to be catched at some outer level [/CORRECTION]
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
modified on Tuesday, June 16, 2009 8:39 AM
|
|
|
|
|
Or use ReadAllLines to read each file into a string array and then loop though with nested foreach loops.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Luc Pattyn wrote: Your try-finally construct will swallow any exception that may occur
Are you sure? Since the catch is missing, the finally block will be executed and the exception rethrown, no?
|
|
|
|
|
Hi,
my mistake, you are right, try-finally without catch does not influence exception throwing/catching at all.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Thank you guys...
I did what Luc said and it worked.
|
|
|
|
|
Hello to everybody....
I have developed an application in C# which one is intended to interact with a database file. Well, as it is not supposed to be a large and complex database, I chose to work with MS Access. So far so good.....
Now, my application is already developed and the database as well, but the following issue came out to my mind: whether it would be possible a multi-user access to be performed upon the database. The number of users is expected to be up to 10.
How to use same MDB file over LAN network, and performing operation parallely from multiple users.
Any article/hint or clue will be highly appreciated and exceptionally helpful!
regards
|
|
|
|
|
Hum Dum wrote: How to use same MDB file over LAN network
Place the db on a place that is accessible for all the pc's in the network (that use your program).
Then you need to alter you connectionstring so that it points to the path where the db is.
Where it comes to locks and performance, it depends on how you'v written your program.
Access isn't the best solution for a multi user environment. And depending on how you'v written your code it could cause db locks or strange behavior when more than 1 user is altering the same data.
Only testing will tell you that.
|
|
|
|
|
thanks for reply.
Tom Deketelaere wrote: need to alter you connectionstring
can i use open dialog box control, so that user can locate the MDB file for 1st time, then store this path on local pc for next uses.
Is it correct way?
Tom Deketelaere wrote: And depending on how you'v written your code it could cause db locks
I am using DataAdapter, then uploading all data in datasets, datatable, then updating back the changes back to original DB as user updates.
Its very helpful of your if you point out to some article or reading stuff, as i know very little about distributed/client-server environment.
I want to know in detail.
regards
|
|
|
|
|
Hum Dum wrote: can i use open dialog box control, so that user can locate the MDB file for 1st time, then store this path on local pc for next uses.
Is it correct way?
That would be the best way yes.
To store the path you can use the settings file (go to project properties --> tab settings).
As to the db locks and such, if there only be 10 users the changes of something going wrong are small, but like others have said you might want to consider going to a different server (sql-express), performance will be better and possible locks are handled better.
If you are staying with access, you might want to consider creating a service or a small tool to 'repair and compress' the database, since it will grow with every update/insert/delete you do.
I don't know of any articles so can't link to them.
|
|
|
|
|
Further to Tom's reply, if the data layer is seperate to the client, it would be better to have an process running locally to the server that can manage the access to the Access DB. With ~10 users it is unlikely, unless it is for data entry, to hit concurrency problems.
A better solution would be to look at migrating the database to one which supports multiple users.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
thanks for reply.
will you plz point me to some article or website from where i can gain the required knowledge?
about server-client approach i know very little.
|
|
|
|
|
Further to Nagys' reply, it is worth planning for the future. If it is intended for 10 users, then plan for 30! Access is not brilliant at multi-user, and you may find bandwidth problems if the DB gets large (as the query is executed at the local machine, rather than on the server hosting the DB.)
I would sugest a client - server approach would be appropriate - nothing too complex, but have a server app to interface with the DB and keep all unnecessary data off the network. This also allows you to control concurrency issues better than just letting several apps access the same DB directly.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi,
i am trying to do a matrix (2X3 cells) in which i want to set each cell to be with different backcolor and text , and to be able to detect a click event on a cell so i could change the cell backcolor and text.
can i do it wuth the TableLayoutPanel control? how?
thanks,
Samy
|
|
|
|
|
samy100 wrote: can i do it wuth the TableLayoutPanel control
Yes.
samy100 wrote: how?
Create your panel, with the rows and columns you want.
Add a label control to each, and set its Dock property to Fill.
Set its TextAlign property to MiddleCenter.
Set each label Click event to the same click handler.
Make your click event look like this:
private void label_Click(object sender, EventArgs e)
{
if (sender is Label)
{
Label lab = sender as Label;
if (lab.BackColor == Color.Red)
{
lab.BackColor = Color.AntiqueWhite;
lab.Text = "Hello";
}
else
{
lab.BackColor = Color.Red;
lab.Text = "Goodbye";
}
}
}
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
We want to open an FTP link in remote desktop machine?
after opening the link we need file information on the FTP link.
How would that happen?
Any help would be appreciated........
Thanks
|
|
|
|