|
DeepOceans wrote: else if (ds == DialogResult.OK)
{
udb-main hmain=new udb-main();// Main class
hmain.activitiesToolStripMenuItem.Enable=true;
hmain.hessloadfunc();
this.Close();
}
You have to assign the parent class to the hmain field instead of assigning a new instance. Most probably it has to be
udb-main hmain = (udb-main)this.Parent;// Main class .
BTW the architecture which is changing the state of a parent element does not seems to be good.
*jaans
|
|
|
|
|
I did it, but now it is giving error:Set object refrence exception.....
Tell another solution.Plzzz
Shanzay
|
|
|
|
|
There is a small change required in both of the functions, we can use Owner instead of Parent
private void bstart_Click(object sender, EventArgs e)
{
UserLogin uslog = new UserLogin();
uslog.Show(this);
}
and
else if (ds == DialogResult.OK)
{
udb-main hmain = (udb-main)this.Owner;
hmain.activitiesToolStripMenuItem.Enable=true;
hmain.hessloadfunc();
this.Close();
}
Please try this.
*jaans
|
|
|
|
|
Thank u so much.
It did work now
Now plz tell me abt my 1 more prob. if u can. When I click Disconnect button it throws exception and application dont close all threads which are using in main as well as its other classes.
private void bDisconect_Click(object sender, EventArgs e)
{
try
{
Client_Login clog = new Client_Login();//child class
clog.clnt_th.Abort();//child class thread
clog.sock.Close();//child socket function
}
catch(System.NullReferenceException expnul)
{
MessageBox.Show(expnul.Message);
}
}
Here what is the main prob.? How to finish this thread exactly.
Shanzay
|
|
|
|
|
Now I am working with webservices.But now we are facing a problem while calling a method in webservice asynchronously from a web page.ie.when the webmethod computes the result it will not get reflected in the webform, because the page would be rendered to the client while the method processing data.Please help me to avoid this problem( without using polling)...........
|
|
|
|
|
hi,
check this link it may help you.
aspalliance.com/337_Review_of_Making_Web_Service_Calls.12
Mhan Kumar
|
|
|
|
|
|
hi all
good morning.i want to use date,month and year seperately in my application.i can use convert function in sql sever for this purpose,but i dont want to refer database unnecessarily again and again.can anyone tell me how to get only the date month and year from the datetime format in the frontend.(c#).
pintoo
|
|
|
|
|
Did it occur to you to read the documentation? Look at the DateTime class.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
System.DateTime moment = new System.DateTime(
1999, 1, 13, 3, 57, 32, 11);
// Year gets 1999.
int year = moment.Year;
// Month gets 1 (January).
int month = moment.Month;
// Day gets 13.
int day = moment.Day;
// Hour gets 3.
int hour = moment.Hour;
// Minute gets 57.
int minute = moment.Minute;
// Second gets 32.
int second = moment.Second;
// Millisecond gets 11.
int millisecond = moment.Millisecond;
|
|
|
|
|
|
I doubt you will be work around this because it's more of a security feature. I use it all the time to verify what link I am actually clicking on, since what's displayed has nothing to do with the underlying link.
For example, http://www.apple.com
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
using c#,I want to get date, month, year from date seperately.
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|
|
Cross posting is rude. Please don't do it.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Check the available properties of Datetime[^] structure.
*jaans
|
|
|
|
|
System.DateTime moment = new System.DateTime(
1999, 1, 13, 3, 57, 32, 11);
// Year gets 1999.
int year = moment.Year;
// Month gets 1 (January).
int month = moment.Month;
// Day gets 13.
int day = moment.Day;
// Hour gets 3.
int hour = moment.Hour;
// Minute gets 57.
int minute = moment.Minute;
// Second gets 32.
int second = moment.Second;
// Millisecond gets 11.
int millisecond = moment.Millisecond;
|
|
|
|
|
Hi,
I would like to retrieve the comments from a word document using c#.net. Is there any method available?
Regards,
PS@CodeProj
|
|
|
|
|
Convert the word doc to an xml format (using an invisible instance of word itself), then parse the xml for the data you need.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Thanks for your post,
but would you please describe it in detail.
Or Is there any library to convert doc to xml?
Help with more detail. Thanks.
|
|
|
|
|
I made a class WordInstance as follows, that instantiates and hides a word instance...
...
using Word = Microsoft.Office.Interop.Word;
...
public class WordInstance : IDisposable {
private const string WORD_APPLICATION_EXE = "WINWORD.EXE";
...
private static readonly object s_Lock = new object();
private Word.Application m_WordApp = null;
...
public WordInstance() {
try {
int attempt = 0;
do {
IList<IntPtr> allWordWinsPrior, allWordWinsAfter;
lock (s_Lock) {
allWordWinsPrior = WinAPI.GetAllRootWindowsOfClass("OpusApp");
Word.Application temp = new Word.Application();
m_WordApp = new Word.Application();
temp.Quit(ref s_QuitNoSave, ref s_QuitEmpty, ref s_QuitEmpty);
m_WordApp.DocumentOpen += new Microsoft.Office.Interop.Word
.ApplicationEvents4_DocumentOpenEventHandler(m_WordApp_DocumentOpen);
allWordWinsAfter = WinAPI.GetAllRootWindowsOfClass("OpusApp");
}
foreach (IntPtr ptr in allWordWinsPrior)
allWordWinsAfter.Remove(ptr);
if (allWordWinsAfter.Count > 1) {
for (int i = allWordWinsAfter.Count - 1; i >= 0; --i)
if (WinAPI.IsWindowVisible(allWordWinsAfter[i]))
allWordWinsAfter.RemoveAt(i);
}
if (allWordWinsAfter.Count > 0) {
m_Handle = allWordWinsAfter[0];
return;
}
} while (++attempt < 3);
throw new Exception();
} catch {
Dispose();
}
}
...
public void Dispose() {
if (m_WordApp != null) {
try {
if (m_WordApp.Documents.Count > 0)
m_WordApp.Documents.Close(ref s_QuitNoSave, ref s_QuitEmpty, ref s_QuitEmpty);
m_WordApp.Quit(ref s_QuitNoSave, ref s_QuitEmpty, ref s_QuitEmpty);
} catch {
if (m_Handle != IntPtr.Zero)
WinAPI.DestroyWindow(m_Handle);
}
m_WordApp = null;
m_Handle = IntPtr.Zero;
}
}
...
private void m_WordApp_DocumentOpen(Word.Document Doc) {
if (m_WordApp == null)
return;
WinAPI.ShowWindow(m_Handle, (uint)WinAPI.SW.HIDE);
string documentName = Doc.Name;
string documentFullName = Doc.FullName;
Doc.Close(ref s_QuitNoSave, ref s_QuitEmpty, ref s_QuitEmpty);
if (documentFullName.Equals(documentName))
openDocInNewWordInstance(null);
else
openDocInNewWordInstance(documentFullName);
}
...
private void openDocInNewWordInstance(string pathFileName) {
ProcessStartInfo wordStartInfo = new ProcessStartInfo(WORD_APPLICATION_EXE);
wordStartInfo.UseShellExecute = true;
wordStartInfo.Arguments = (string.IsNullOrEmpty(pathFileName)
? "/w" : string.Format("/w \"{0}\"", pathFileName));
wordStartInfo.WindowStyle = ProcessWindowStyle.Normal;
Process.Start(wordStartInfo);
}
} After instantiating word, use the word API to save the file in the xml doc format. Then close word, load the doc and parse the xml. You will need to become familiar with some WinAPI functions along with the Word API. Good luck.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hi all,
I am developing a windows service using C#.I need to set this service for a domain user.Only this user is able to start the service.
I put my account type as User.but it is still open for other user .
How to do this.
Please help me.
Thanks
Narendra
|
|
|
|
|
You can use WindowsIdentity and WindowsPrincipal Class
|
|
|
|
|
asdfsadf
Just do the American thing and shoot him... - Jim Crafton on Linux Users
Wh3n my l33t skillz 1mpr0v3, I w1ll h4ck M$, 4nd th3n wh0 w1ll b3 l4ugh1ng ? N0t Bill. H4 h4 h4 h4 h4 h4 h4. - Christian Graus
|
|
|
|
|
hhhhhh
In India, when someone says "mad cow", you know it's actually a bull charging at him.
-- Rohit Sinha
|
|
|
|
|
Stop posting crap to the forums!!!!
|
|
|
|