|
Hello I'm developing Guest book For web I'm using C#.net for this project but I have problem
I'm Storing data in a xml file My web path variable is : string webpath="../omur/Ziyaretciler.xml" but returned me this error message:
Could not find a part of the
path "C:\windows\Omur\Ziyaretciler.xml".
how do I develope for this problem?
Heeellppp..
Ahmed Erarslan
MCAD,MCDBA,MCP
MCSD.NET
|
|
|
|
|
Hi every body , from day i have a problem that i can't solve , how i can pass a STRING variable by using a matlab program dll .
The document 1,2,3 ways offer just a double variable
Plz i need it ,
thx
|
|
|
|
|
Type type = Type.GetType("System.Int32");
object result = null;
//****************
result = type.GetMethod("Parse").Invoke(null,BindingFlags.Static | BindingFlags.Public,null,new object[]{"7"},null); //where is wrong???
//****************
Console.WriteLine(result.ToString());
thank you!
|
|
|
|
|
System.Int32.Parse hase more than one overload.
So you have to define which of the overloads you need.
You do so by specifying the parameters in the GetMethod of the Type .
result = type.GetMethod("Parse", new Type[]{typeof(string)}).Invoke(null,BindingFlags.Static | BindingFlags.Public,null,new object[]{"7"},null); //this is correct
/cadi
24 hours is not enough
|
|
|
|
|
thank you very much!OK
|
|
|
|
|
Hi, I've a Windows form on which i've multiple rows & column having radio buttons....At the run time i want all the radio buttons in a column to be checked by default......If anyone got idea plz help me....
E.g
Brand RadioButton RadioButton RadioButton RadioButton
Type RadioButton RadioButton RadioButton RadioButton
Category RadioButton RadioButton RadioButton RadioButton
So here i want at the run timethat all the radiobuttons in one of the column is selected by default
|
|
|
|
|
Hello all,
I have typical problem as following.
I have user control (grid contorl)developed in vc++ and compiled version is in .lib file.
Same control i want to use in c#.
As we cant call .lib file or have reference of .lib in .net project, we have to write some intermediate code /wrapper class.
Do i need to convert first .lib file into dll in vc++?
If yes the control is a class not just a group of function.Is it possible?
so how to write it.I am not a vc guy.
Is there any approch hwo to go about it?Can you step by step information.
it will be great if i get reply soon..i m really stuck here...
thanks and regards,
Urvish
|
|
|
|
|
The only way i know is to create an ActiveX wrapper class in C++.
You could then use this control via COMInterop.
But since you said you are no C++ guy i would suggest you look for some GridControl implemented in .NET.
Search CodeProject for GridControl, there are some on this site.
/cadi
24 hours is not enough
|
|
|
|
|
I am using MCMS 2002 the problem i m facing is with cookies.
The cookies I am using losts its value after accessing it. THe code I am using is as
1) MCMS is installed on Windows XP.
2) Piece of code to set the cookie.
HttpCookie objCookie = new HttpCookie("LanguagePreference");
Response.Cookies.Clear();
Response.Cookies.Add(objCookie);
objCookie.Values.Add("LanguagePreference","En");
Response.Cookies["LanguagePreference"].Expires = DateTime.Now.AddDays(15);
3) Piece of code to get the cookie back.
a) cookieValue = Request.Cookies["LanguagePreference"].Value
or
b) cookieValue = Response.Cookies["LanguagePreference"].Value
Problem Statement ::
1) Cookie set Successfully using code in step 2.
2) Now if I try to get this cookie back using code at line 3(a) [in Request object] then I get it for first time & then that cookie is deleted automatically.
3) When I try to get this cookie back using code at line 3(b) [in Response object] then that cookie is deleted automatically immediately.
Any Solutions ?
Pushpesh Pandey
pinchu636595@yahoo.co.in
|
|
|
|
|
Hi,
Here is the program for displaying simple text in excel using late binding.
It checks at run time.This program works on all the version of Excel.
I want to modfify this program.
Can anybody help me to do that.
I want to display All the rows and coulmns of Emp table
This is very easy with early binding. I want to do that with late binding
here is code
Write this code inside button click event pls anybody modify I want to display table conntents Excel using late binding
----------------------------------------
object objApp_Late;
object objBook_Late;
object objBooks_Late;
object objSheets_Late;
object objSheet_Late;
object objRange_Late;
object[] Parameters;
int intExcelPID;
try
{
// Get the class type and instantiate Excel.
Type objClassType;
objClassType = Type.GetTypeFromProgID("Excel.Application");
objApp_Late = Activator.CreateInstance(objClassType);
Process[] aProcesses=Process.GetProcessesByName("Excel");
// please remove the string variable
string strProc="These are the processes running \n";
for (int i = 0; i <= aProcesses.GetUpperBound(0); i++)
{
intExcelPID = aProcesses[i].Id;
strProc+=intExcelPID.ToString()+ " ";
}
//Get the workbooks collection.
objBooks_Late = objApp_Late.GetType().InvokeMember( "Workbooks",
BindingFlags.GetProperty, null, objApp_Late, null );
//Add a new workbook.
objBook_Late = objBooks_Late.GetType().InvokeMember( "Add",
BindingFlags.InvokeMethod, null, objBooks_Late, null );
//Get the worksheets collection.
objSheets_Late = objBook_Late.GetType().InvokeMember( "Worksheets",
BindingFlags.GetProperty, null, objBook_Late, null );
//Get the first worksheet.
Parameters = new Object[1];
Parameters[0] = 1;
objSheet_Late = objSheets_Late.GetType().InvokeMember( "Item",
BindingFlags.GetProperty, null, objSheets_Late, Parameters );
//Get a range object that contains cell A1.
Parameters = new Object[2];
Parameters[0] = "A1";
Parameters[1] = Missing.Value;
objRange_Late = objSheet_Late.GetType().InvokeMember( "Range",
BindingFlags.GetProperty, null, objSheet_Late, Parameters );
//Write "Hello, World!" in cell A1.
Parameters = new Object[1];
Parameters[0] = "Hello, World!";
objRange_Late.GetType().InvokeMember( "Value", BindingFlags.SetProperty,
null, objRange_Late, Parameters );
//Return control of Excel to the user.
Parameters = new Object[1];
Parameters[0] = true;
objApp_Late.GetType().InvokeMember( "Visible", BindingFlags.SetProperty,
null, objApp_Late, Parameters );
objApp_Late.GetType().InvokeMember( "UserControl", BindingFlags.SetProperty,
null, objApp_Late, Parameters );
Parameters = new Object[1];
Parameters[0] = "Test2.xls";
objBook_Late.GetType().InvokeMember( "SaveAs", BindingFlags.InvokeMethod, null, objBook_Late, Parameters );
Parameters = new Object[1];
Parameters[0] = "Test2.xls";
objBook_Late.GetType().InvokeMember( "Close", BindingFlags.InvokeMethod, null, objBook_Late, Parameters );
// Check if the array of "EXCEL" processes exists
if (aProcesses.Length > 0)
{
// The last excel process is the orphaned process which is killed
aProcesses[aProcesses.Length-1].Kill();
}
}
catch( Exception theException )
{
String errorMessage;
errorMessage = "Error: ";
errorMessage = String.Concat( errorMessage, theException.Message );
errorMessage = String.Concat( errorMessage, " Line: " );
errorMessage = String.Concat( errorMessage, theException.Source );
MessageBox.Show( errorMessage, "Error" );
}
Any clue
regards
sanjeev
|
|
|
|
|
When I xml serialize a file, I want all the empty node should not appear. e.g.
The below mentioned xml serialized file has empty region node.
<Application>
<Name>abc</Name>
<Region/>
<Application>
I want empty node should not appear in xml serialized file.
<Application>
<Name>abc</Name>
<Application>
I appreciate, if anyone has any solutions or suggestions to this, please share their knowledge.
Regards,
Shiby
|
|
|
|
|
|
g'day guys,
i am stuck on a small problem which is starting to frustrate me a little. I have written a small c# application which displays a list of files. When a user selects one or more of the files it gets the selected files sends the file UNC path as hyper links to the email. The program itself invokes outlook to generate the emails.
If I were to simply use the generic outlook email editor (i.e. not ms word), it works fine. I have included a fragment of my code at the bottom.
The problem arises when outlook is configured to use ms word as the default email editor. There is no link being displayed in the body of the email. So I decided to write the content of the HTMLBody to console. What I found was that the link i am inserting using the <a> </a> tags is sitting out side the <html> & </html> tags.
To totally contridict my findings, I reverted the outlook email editor to Outlook's own editor (ie. not using ms word). I examined the contents of oMailItem.HTMLBody via console. My reference file enclosed in the <a> </a> tags was sitting outside the <html></html> tags. But the email itself showed the file as hyperlinks. I dont understand why this is possible!!!!
My question is how do I insert the reference file link within the <html></html> tags of the email body in c#??? At this point I am completely stumped. Is there a solution that can suit either types of email editors in outlook ????
Any suggestions ????
thanks
<code>
private void createEmail(object sender, System.EventArgs e)
{
string PostingNotice ="";
string EmailBody="";
string sHtml="";
oApp = new Outlook.Application();
oNameSpace= oApp.GetNamespace("MAPI");
oNameSpace.Logon(null,null,false,true);
oOutlookFolder = oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail);
Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMailItem.Display(false);
foreach (ListViewItem lvitem in listView3.Items)
{
int index = int.Parse(lvitem.Index.ToString());
string filename = selectedFileArrayList[index].ToString();
int lastindex = filename.LastIndexOf('\\');
string displayFilename = filename.Substring(lastindex+1, ((filename.Length) - (lastindex+1)));
//assume fileUNCPath as a string variable containing the UNC path of the file
sHtml = "<a href= "+"\""+fileUNCPath+"\">"+displayFilename+"</a>\n"+"<br>\n";
oMailItem.HTMLBody = sHtml + oMailItem.HTMLBody; //append file link to email body
}
oMailItem.Display(false);
}
</code>
|
|
|
|
|
You are prefixing the sHtml text before the oMailItem.HTMLBody which naturally lands up before the html part which includes ..
Try using
oMailItem.Body = sHtml;
oMailItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;
|
|
|
|
|
thanks for replying.. but i dont quite understand your suggestion. I did try it out but it didnt make any different. I dont understand why would you want to do this :
oMailItem.Body = sHtml;
The way I understand is that Body simply indicates the plain text. What if your email contains a signature and the signature has an image as well. then you are loosing this image.
Do you think you could explain it a bit more.
What I was thinking is that instead of sHtml being assigned to HTMLBody when the sHtml string is created. Instead keep appending hyperlinks to the sHtml. Once the FOR loop finishes then do the following:
oMailItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;
signature = oMailItem.HTMLBody; //extract signature
Console.WriteLine(signature);
oMailItem.Body="";
oMailItem.Body+=sHtml;
oMailItem.HTMLBody=oMailItem.Body+signature;
With the above i am still loosing the image in the signature.
|
|
|
|
|
//I have an array of panels
public Panel[] a = new Panel[10];
//During the creation of 10 panels i set the tag for each panel as below
int i = 0;
for (i = 0; i < 9; i++)
{
a[i] = new Panel();
a[i].Parent = a_Holder;
a[i].Tag = i;
a[i].Top = (i * 16);
a[i].Left = 10;
a[i].Height = 15;
a[i].Width = 250;
a[i].Click += delegate { abcd( a[i] ) };
}
//on clicking a panel the below method is called
public void abcd (object sender)
{
textbox1.text = convert.tostring(sender.tag);
}
I basically want to be able to click on a panel and have that panels tag come up in the textbox. The above example does not work and im sure im way of base, can anyone help?
Cheers
|
|
|
|
|
This code does not work because object does not have a tag property. First cast it to Panel ( which is what it will be ). Of course, you should replace your delegate with a proper OnClick handler ( I'm sure that's not the right syntax, don't you need an eventargs, and you sure have the syntax for adding an event handler all wrong. ).
'The above example does not work' is not very helpful - in future try telling us why. I doubt this would compile, so report the compiler errors. If it crashes, report which line crashes and what the exception is. Working that stuff out might actually help you to fix the problem yourself ( not that we mind helping, but surely you want to learn how to do it yourself ? )
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Sorry, i've only been using C# for about a week and i've still got a lot to teach myself. However your comments helped and it now makes a lot more sense to me
Thanks for your help!
|
|
|
|
|
<br />
textBox1.Text = Convert.ToString((int)((Panel)sender.Tag));<br />
|
|
|
|
|
Let see this case:
I need to show the aform, and write code
aform f = new aform(someparameter);
f.Show();
and in the form's code. I use "someparameter" to determine if I should still show the form or Close it.
(this is done automatically, in FormLoad, constructor... etc; without anymore interaction from user (like event))
How this can be done?
|
|
|
|
|
this.Close();
It's the wrong model though - you should work out if you want to show it before you do. Anyone looking at this code is right to assume the form will be shown.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
If at all, you want to do -
Override the constructor with parameters public Form3(string args)
{ if args=="dontshow!" this.Close() // and dispose the object and come out }
However, the best and easier way to handle is to do it before hand since you have the parameters in hand before!
|
|
|
|
|
Why do people keep answering questions by posting under someone elses answer ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
Why do people keep answering questions by posting under someone elses answer ?
I don't know why, but apparently you seems to be getting a couple of them.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
Thats because we had answered at the same time! believe from various locations. Take care, sorry for the trouble guys for this thread!
|
|
|
|
|