|
i am trying to take under control of changing datarows. when there is a change i want to ask user whether he/she wants to save changes or discard changes. to accomplish this i am using rowchanged event
private void Form1_Load(object sender, EventArgs e)
{
this.kisiTableAdapter.Fill(this.denekDataSet.Kisi);
denekDataSet.Kisi.KisiRowChanged += new denekDataSet.KisiRowChangeEventHandler(Kisi_KisiRowChanged);
}
void Kisi_KisiRowChanged(object sender, denekDataSet.KisiRowChangeEvent e)
{
DataRowAction drc = e.Action;
if (drc == DataRowAction.Change)
{
DialogResult dr = MessageBox.Show("do you want to save changes!", "warning", MessageBoxButtons.YesNo);
if (dr == DialogResult.No)
{
e.Row.RejectChanges();
}
}
}
when there is a change this event works. and if user choice is "no" it works perfectly. but dialog result is "yes", there is a problem appears. changes are not apply to the database(restart the program). everything same as before the change action.
i tried different ways but it causes different errors(exception).
void Kisi_KisiRowChanged(object sender, denekDataSet.KisiRowChangeEvent e)
{
DataRowAction drc = e.Action;
if (drc == DataRowAction.Change)
{
DialogResult dr = MessageBox.Show("do you want to save changes!", "warning", MessageBoxButtons.YesNo);
if (dr == DialogResult.No)
{
e.Row.RejectChanges();
}else
{
kisiTableAdapter.Update(denekDataSet.Kisi);
}
}
}
after changing it calls many times messagebox for asking choice then produces InvalidOperationException and stops.
how can i solve this problem, it makes me anger and tired.
please help me , or show me a different way.
my intention is tracking changes and asking right question.
thanks for interests
::CTBRS::
|
|
|
|
|
there is not any answer, please help me.
::CTBRS::
|
|
|
|
|
Hey Everyone,
I am doing a VB6 to C# conversion and everything was going smoothly until I realized that I needed to call a Fortran 77 (.for) .dll inside my code. I have looked through everything I have found using Google and have still been unable to get it to successfully work. Currently the following call works about 75% of the time, but the other 25% of the time my program just calls the .dll and then it simply exits; no error/exception occurs, it just quits without executing anymore code. As you can see I have tried multiple ways to catch/generate error messages. I have no Fortran experience and I was told to leave the Fortran code alone, since it has been around and working since the 70’s.
From what I can tell the Fortran code only has one subroutine. I have included the header/parameters below:
SUBROUTINE FORTRANCALLA(INPUTL, TABLEL, NAMEL2, COMMAL, LOADL)
EXTERNAL F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F20
!DEC$ ATTRIBUTES DLLEXPORT :: FORTRANCALLA
!DEC$ ATTRIBUTES STDCALL, ALIAS: 'FORTRANCALLA' :: FORTRANCALLA
!DEC$ ATTRIBUTES REFERENCE :: INPUTL
!DEC$ ATTRIBUTES REFERENCE :: TABLEL
!DEC$ ATTRIBUTES REFERENCE :: NAMEL2
!DEC$ ATTRIBUTES REFERENCE :: COMMAL
!DEC$ ATTRIBUTES REFERENCE :: LOADL
CHARACTER(80), INTENT(IN) :: INPUTL
CHARACTER(80), INTENT(IN) :: TABLEL
CHARACTER(80), INTENT(IN) :: NAMEL2
CHARACTER(4), INTENT(IN) :: COMMAL
CHARACTER(80), INTENT(IN) :: LOADL
It appears C++ was used to wrap the .for file and generate a .dll which was called in the VB6 program using the following code:
Call Fortran.FORTRANCALLA(infilecalc, tablecalc, destination2, format, loadcond)
Public Declare Sub FORTRANCALLA Lib "Name.dll" _
(ByVal INPUTL As String, ByVal TABLEL As String, ByVal NAMEL2 As String, ByVal COMMAL As String, ByVal LOADL As String)
It appears that the VB6 program also has problems with the call, but not as frequently. However, it also handles the failed .dll call much better and does not crash. If possible I would just like my program not to fatally crash.
Here is the code I am currently working with and I am calling the exact same .dll that is currently being used in the VB6 version:
static class Fortran
{
[DllImport("Name.dll")]
private static extern bool FORTRANCALLA(
StringBuilder infilecalc,
StringBuilder tablecalc,
StringBuilder destination2,
StringBuilder format,
StringBuilder loadcond);
public static void Calculate(string infilecalc, string tablecalc, string destination2, string format, string loadcond)
{
string tempOutputPath = FileMod.GetTemporaryDirectory() + "NameTemp.tmp";
StringBuilder bldrInFileCalc = new StringBuilder(infilecalc, 80);
StringBuilder bldrTableCalc = new StringBuilder(tablecalc, 80);
StringBuilder bldrDestination2 = new StringBuilder(tempOutputPath, 80);
StringBuilder bldrFormat = new StringBuilder(format, 4);
StringBuilder bldrLoadCond = new StringBuilder(loadcond, 80);
try
{
if (!FORTRANCALLA(bldrInFileCalc, bldrTableCalc, bldrDestination2, bldrFormat, bldrLoadCond))
MessageBox.Show(new System.ComponentModel.Win32Exception().ToString());
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
//FORTRANCALLA(bldrInFileCalc, bldrTableCalc, bldrDestination2, bldrFormat, bldrLoadCond);
File.Copy(tempOutputPath, destination2, true);
File.Delete(tempOutputPath);
}
}
Right now I cannot find a pattern to the crashes. I could work with the same files, making identical calls to the .dll, and sometimes it works sometimes it doesn't. At first I thought it was something to do with memory allocation, but I don't think that is the case because sometimes it crashes on the first call. Sometimes it only crashes once, sometimes it crashes multiple uses in a row, and sometimes you can make many calls before it starts crashing again.
Does anyone have any ideas? Because I am officially out of ideas...
Thanks,
Nitsua
|
|
|
|
|
Hey guys, what up?
Kinda new to the message board. Hope I'm welcome
I have this problem with a web service; I'm writing a library which hosts a web service which holds an event as a member. Now I want to be able to add a delegate to that event from the library, which is of course not really possible through a web service method since a delegate is kinda like a function pointer.
Someone mentioned the possibility of using named pipes or some other kind of IPC. Does anyone know of such a solution? Can anyone here point me to an example of such implementation?
Thanks in advance,
LZ
|
|
|
|
|
Not sure how much this helps but you might be able to use reflection to achieve something similar? For example instead of storing a delegate, store the class & method name in a string, then use refelction to invoke...
Possibly not what you are looking for, but it might be an approach to consider if you don't get any other suggestions
Hope this helps,
Chris
|
|
|
|
|
I think reflection might help me out.. but I'm looking for a more elegant solution from WCF.
Does anyone know of such?
|
|
|
|
|
hello frnds,
i am trying to insert/select record to/from database.
but at the same time the databse throws me exception as
System.Collections.ListDictionaryInternal
how can resolve that exception ???
thankx in advnace
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
koolprasad2003 wrote: at the same time the databse throws me exception as
System.Collections.ListDictionaryInternal
That is definitely not an exception, please post the correct exception if you want us to help you.
|
|
|
|
|
I'm try to make a little to monitor for my sockets. I would like to get info on each connection, like end points, time connected, blah, blah. I have read few articles on sockets they appear to all be about creating new sockets. I just want list active connections. I would think that there is a .net object that does some thing like this but i seem to find it. Any suggestions? Thanks
|
|
|
|
|
|
Thank you but Socket.Select requires you to pass known sockets it. I need a way pulling the active sockets, I'm wanting to watch all Sockets on my box for activity
Thanks
|
|
|
|
|
Create a list of Socket instances (not opened), of all 64 * 1024 port on your system, pass that to Socket.Select.
|
|
|
|
|
|
Hi All,
I have changed my site from one IP to another very recently and copied all files from old to new IP.
But I am getting some errors intermittently when I am trying to access .net pages. I am using asp along with C#.net in my site. But the error is only for .net pages. Interestingly these errors will resolve after some times and site will work. After 10 or 20 minuets the errors will appear again. Please help
|
|
|
|
|
Why the flood of ASP.NET questions in the C# forum tonight ?
I suggest you ask in the right forum and try posting some code. You have some code, somewhere in your site, we're not sure what it does, but it fails sometimes. Not sure how to answer that.....
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hello everyone,
I am new to URL escape, my questions are,
1. What are the rules for URL escape?
2. What are the issues if an URL is escaped more than one time?
3. Are there any ways to check for an input URL string, whether or not it is escaped?
thanks in advance,
George
|
|
|
|
|
1 - these are easily googled, surely an article is a better thing to rely on here than a forum reply ?
2 - You can write code to see the effects, just call it over and over and see what you get.
3 - yes, check for invalid characters, such as spaces. Get a full list of invalid chars, if any are there, it has not been, if not, it has been or doesn't need to
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Thanks Christian,
For 1, actually I have found some ones.
For 2, I am just wondering whether there are any CLR/C# class supports escape?
For 3, I have no idea, do you have any referred articles? Invalid chars and spaces you mean what?
regards,
George
|
|
|
|
|
Yes, there is a class that does this in the ASP.NET namespaces, I am pretty sure.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Thanks Christian,
You mean using API HttpUtility.HtmlEncode to escape/encode URL? Not sure whether you mean this one, could you help to confirm please?
regards,
George
|
|
|
|
|
.NET has a class for this (and HTML).
Look at System.Web.HttpUtility
|
|
|
|
|
Cool leppie,
Any ideas for my question item 3? If it is pure ASCII character set, it should not be hard, but if it contains unicode... Any ideas?
regards,
George
|
|
|
|
|
You can use this overload:
public static string UrlDecode(string str, Encoding e)
Just pass Encoding.Unicode (default is UTF8).
|
|
|
|
|
Sorry leppie!
My question item 3 is -- "For an input URL string, whether or not it is escaped"? I think the API you provided is to do URL decode (unescape), not to check whether or not it is escaped or not. Any comments?
regards,
George
|
|
|
|
|
George_George wrote: Sorry leppie!
It's my fault, I didnt read it completely
I am not sure, maybe you can look for the encoding characters (% isnt it?).
|
|
|
|
|