|
Hi,
Was wondering if anyone could recommend useful objects that could be used to programmatically compare two files/strings visually using dot net. {i.e.?? Using two grid controls that move in sync with each other?? - if possible}
Looking for useful places to look objects that could implement something similar to windiff/winmerge functionality... Highlighting differences quickly.
Just wondering where to start and if there are Addins etc that could programmatically do this..
If anyone has any information that would be great.
Regards
di
|
|
|
|
|
Hi,
I am getting the below error and am very confused. Firstly, the error is telling me i cant convert an object into the same object, WHAT?!
Object of type 'ConceptualGraph.Edge.IEdge[]' cannot be converted to type 'ConceptualGraph.Edge.IEdge[]'.
I get the error when trying to view a form in VS design mode which has a control on it. The only instance of an Edge[] is a generic List of IEdges i have in the control which just adds a new item to it or removes it.
Any ideas whats going off?
Regards,
Gareth.
|
|
|
|
|
A wild guess is that the Designer is interfacing with your custom controls IEdge member in some default way that it doesn't support like returning an Array. You probably have to provide an interface the Designer can use or maybe just make it private so the Designer ignores it, that all depends on your intended use of the IEdge List.
No way to be sure from what you posted but something in that general area.
led mike
|
|
|
|
|
I need some help. I can't seem to get my onclick event to fire when I render my buttons using ".RenderControl". Can somebody tell me what I need to do to get this to work. Thanks
<br />
public override void Render(HtmlTextWriter writer)<br />
{<br />
LoadSearchLibraryTitle(libraryID,writer);<br />
LoadSearchFields(libraryID,writer); <br />
}<br />
<br />
protected void LoadSearchFields (int libraryID, HtmlTextWriter htmlWriter)<br />
{ <br />
int fieldCounter = 0;<br />
<br />
SPFieldCollection listFieldCollection = listCaml.GetPropertiesOfDocumentLibrary(libraryID);<br />
<br />
htmlWriter.Write(@"<div style=""text-align:left"">");<br />
htmlWriter.WriteBreak();<br />
htmlWriter.Write("<table width='100%'>");<br />
htmlWriter.WriteBreak();<br />
htmlWriter.Write("<tr>");<br />
htmlWriter.WriteBreak();<br />
<br />
foreach (SPField listField in listFieldCollection)<br />
{<br />
if (!listCaml.IsHiddenField(listField.InternalName, ListGlobals.hiddenLibrarySearchField))<br />
{ <br />
htmlWriter.Write(@"<td style=""width: 20%; text-align:right;"">");<br />
<br />
Label label = new Label();<br />
label.Text = listField.Title + ":";<br />
<br />
label.RenderControl(htmlWriter);<br />
htmlWriter.Write("</td>");<br />
<br />
htmlWriter.Write("<td>");<br />
TextBox textBox = new TextBox(); <br />
textBox.MaxLength = Convert.ToInt16(listField.DisplaySize);<br />
textBox.ID = listField.InternalName;<br />
textBox.Text = listField.InternalName;<br />
<br />
<br />
<br />
textBox.RenderControl(htmlWriter); <br />
htmlWriter.Write("</td>");<br />
<br />
fieldCounter++;<br />
<br />
if (listFieldCollection.Count > 10)<br />
{<br />
if (fieldCounter == 2)<br />
{<br />
htmlWriter.Write("</tr>");<br />
htmlWriter.Write("<tr>");<br />
fieldCounter = 0;<br />
}<br />
}<br />
else<br />
{<br />
htmlWriter.Write("</tr>");<br />
}<br />
} <br />
}<br />
<br />
htmlWriter.Write("<tr>");<br />
htmlWriter.Write(@"<td style=""width: 20%; text-align:right;"">");<br />
htmlWriter.Write("</td>");<br />
htmlWriter.Write("<td>");<br />
<br />
LoadSearchButtons(htmlWriter);<br />
<br />
htmlWriter.Write("</td>");<br />
htmlWriter.Write("</tr>");<br />
<br />
htmlWriter.Write("</table>");<br />
htmlWriter.Write("</div>"); <br />
}<br />
<br />
protected void LoadSearchButtons(HtmlTextWriter htmlWriter)<br />
{<br />
searchButton = new Button();<br />
searchButton.Text = "Search";<br />
searchButton.RenderControl(htmlWriter);<br />
<br />
htmlWriter.Write(" ");<br />
<br />
resetButton = new Button();<br />
resetButton.Text = "Reset"; <br />
<br />
<br />
this.searchButton.Click += new EventHandler(searchButton_Click); <br />
this.resetButton.Click += new EventHandler(resetButton_Click);<br />
this.Controls.Add(resetButton);<br />
resetButton.RenderControl(htmlWriter);<br />
<br />
}<br />
<br />
protected void resetButton_Click(object sender, System.EventArgs e)* This won't fire when I us RenderControl.<br />
{ <br />
foreach (Control controls in this.Controls)<br />
{ <br />
if (controls is TextBox)<br />
{<br />
TextBox textBox = (TextBox)controls;<br />
textBox.Text = "";<br />
} <br />
}<br />
}<br />
<br />
protected void searchButton_Click(object sender, System.EventArgs e)* This won't fire when I us RenderControl.<br />
<br />
{ <br />
Server.Transfer(@"/LibrarySearch/ProcessingSearch.aspx");<br />
} <br />
<br />
<br />
<br />
<br />
|
|
|
|
|
Postback events are matched to their corresponding control and handler after Load and before LoadComplete . In order for your control to receive an event, it must be created, placed in the control tree (in the same naming container hierarchy), and have the event handler registered by the end of the Load portion of the page life cycle. Since your button does not get created until the page is in its Render state, it will never receive an event.
Hope that helps.
PS- You may want to consider posting these types of questions in the ASP.NET forum in the future.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
That was my issue.. when I move the control.add out of the render method it works.
thanks alot.
|
|
|
|
|
My pleasure. Glad it helped.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
Populating one my WinForms submenu requires database access over internet.
So it is better to populate it at runtime when in may become visible.
For this I use designer generated code in form constructor:
this.openToolStripMenuItem.DropDownOpening += new <br />
System.EventHandler(this.openToolStripMenuItem_DropDownOpening);
Initially menu does not contain any items.
When I move mouse to aparent menu item all is OK: DropDownOpening event
handler fills this menu with items.
However when I use keyboard keys to move to parent item, this event does not
fire: selection triange does not appear and it is not possible to open
submenu. I tried to use
this.openToolStripMenuItem.CanSelect = true; but got compile error CanSelect being is read only.
How to populate submenu when parent menu item is activated using keyboard ?
Andrus.
Andrus
|
|
|
|
|
Hi Andrus,
I've just taken a look at some code of mine that populates a submenu with a list of available COM ports and I think you have the drop down opening handler attached to the wrong menu item.
You want the selection triangle to appear when you activate the parent of the openToolStripMenuItem which is probably fileToolStripMenuItem. If you build your submenu when the fileToolStripMenuItem drops down it should all start working properly.
Alan.
|
|
|
|
|
Thank you.
I have 3-level menu structure
File
Open company
Company1
Company2
....
Companyn
I want that:
1. Selection triangle for "Open Company" is shown always.
2. Dynamic list Company1 .. Companyn is built only when I move focus to "Open company" item.
Issues:
1. I do'nt know how to enable selection triange initially in "Open company" menu when its list is empty.
2. When I highlight "Open company" menu item using keybord arrows, dynamic list is not populated.
Your suggestion to populate in file menu works but in this case menu is populated always when File menu is opened.
I need that menu is populated only when
In this case owever the dropdown is populated only When "Open Company" is selected from keyboard (selection from mouse works).
Andrus.
Andrus
|
|
|
|
|
Andrus,
I’ve been experimenting with my code to see if I could get the action you desire.
Clearly if you want to see a selection triangle then a submenu must be present. Why not replace a dummy submenu item at run time with your desired menu. Example code from my own application as follows.
private void openToolStripMenuItem_DropDownOpening(object sender, EventArgs e) {
dummyItem = openToolStripMenuItem.DropDownItems[0];
openToolStripMenuItem.DropDownItems.Clear();
ToolStripMenuItem comPortMenuItem;
String[] ports;
app.GetPortNames(out ports);
foreach (String port in ports) {
comPortMenuItem = new ToolStripMenuItem();
comPortMenuItem.Click += new EventHandler(comPortMenuItem_Click);
comPortMenuItem.DisplayStyle = ToolStripItemDisplayStyle.Text;
comPortMenuItem.Size = new System.Drawing.Size(152, 22);
comPortMenuItem.Text = port;
openToolStripMenuItem.DropDownItems.Add(comPortMenuItem);
}
}
private void openToolStripMenuItem_DropDownClosed(object sender, EventArgs e) {
openToolStripMenuItem.DropDownItems.Clear();
openToolStripMenuItem.DropDownItems.Add(dummyItem);
}
It's not very neat but it does work for both mouse and keyboard.
Alan.
|
|
|
|
|
I am creating a form where a user will fill out the form submit and will be sent as an e-mail. By using the asp:FileUpload will be able to send an attachment. I am using the MailMessage class to construct the e-mail and have it sent to a designated e-mail address. Where I am having troubles getting my head around is how to manage the attachments. The site itself is hosted off-site and I do not have a lot of space so the attachment needs to come directly to the building, or be held in a temp folder and be deleted after sending. I tried the following.
if (this.fiupDesign.HasFile)
{
filePath = Server.MapPath("~/App_Support/TempStorage");
filePath = Path.Combine(filePath, Path.GetFileName(this.fiupDesign.FileName));
this.fiupDesign.SaveAs(filePath);
fiupDesign.PostedFile.InputStream.Close();
} //end if
//Construct E-mail
mm = new MailMessage (this.txtEmail.Text, "email@email.com");
mm.IsBodyHtml = false;
mm.Subject = string.Format("Design - {0}", this.txtPatternName.Text);
mm.Body = sbTemplate.ToString();
mm.Attachments.Add(new Attachment(filePath));
sc = new SmtpClient("localhost");
sc.UseDefaultCredentials = true;
sc.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
sc.Send(mm);
/* Clean up temp file */
if (File.Exists(filePath))
File.Delete(filePath);
The problem here is that my cleanup of the temp file tries to delete the attachments to quickly and before they are sent so it throws an error saying "file is in use by another process." How would you of gone about doing this? Any help here would be fantastic. Even if it is an entirely different direction because this above isn't working.
Thank you for your help!
|
|
|
|
|
Wow. Don't write the file to disk just to turn around and read it and then delete it. Jeez dude.
Try using the Documentation for all the classes you are using and you will see that you can use the incoming stream to create the attachment without writing the file to disk.
led mike
|
|
|
|
|
yes you are correct that I am not doing this right. Can anyone expound on the incoming stream and how to use this properly?
Thank you for your help!
|
|
|
|
|
kknepple wrote: Can anyone expound on the incoming stream and how to use this properly?
led mike wrote: Try using the Documentation
Stop making me repeat myself
led mike
|
|
|
|
|
I am sorry to have inconvenienced you but I was looking for help and have been reading the documentation and don't understand it ok? I will continue to read the documentation and I hope I find the answer. I believe these forums are here to help someone who has a question. I do understnad that there is a tendency for some laziness and people are looking to just have other people to do the work for them but I am having trouble understanding this. so if this is not the forum to get help please let me know. I mean do you go to every post and say read the documentation?
yes, you are a better programmer then me.
yes, you have been doing this longer than me.
yes, I do not know where to look.
yes, I came here for help.
is there a programmer out there that would shed some light on the subject? Like what do you need to include to read the data into the MemoryStream and what you need to read the data back out even you led Mike was a beginner at some point and came here for help before you became an MVP.
Thank you for your help!
|
|
|
|
|
kknepple wrote: and have been reading the documentation and don't understand it ok?
yep that's fine. Post the part(s) you don't understand ( and the URL to the source ) and ask specific questions. Folks here will gladly help if you do that.
kknepple wrote: Like what do you need to include to read the data into the MemoryStream
You don't have to, it's already in a stream in memory as part of the FileUpload object. Read the documentation.
led mike
|
|
|
|
|
led mike wrote: Read the documentation.
Wow. Groundhog post.
"Rise and shine campers. It's cold out there."
|
|
|
|
|
I would re-arrange this code a bit.
mm = new MailMessage (this.txtEmail.Text, "email@email.com");
mm.IsBodyHtml = false;
mm.Subject = string.Format("Design - {0}", this.txtPatternName.Text);
mm.Body = sbTemplate.ToString();
if (this.fiupDesign.HasFile)
{
string fileName = Path.GetFileName(this.fiupDesign.FileName);
mm.Attachments.Add(new Attachment(this.fiupDesign.FileContent,fileName));
}
The FileContent property returns a stream (the uploaded file) and the Attachment class has a constructor which takes a stream and the filename to use. This negates ever having to save the file to disk and running into the locking issue.
|
|
|
|
|
Hi guys
I need to write an application in C # that it will auto run when window start up. Need some info and resource on how about creating in? Any example code and sample will be deeply appreciated
Thanks A million
KaKaShi HaTaKe
|
|
|
|
|
You can run pretty much any application at Windows startup by putting a shortcut to the application's executable file in Start Menu - Programs - Startup. You have to check for localization issues (in my Spanish Windows, it's Inicio instead of Startup.)
Environment.GetFolderPath[^] with SpecialFolder.Startup[^] can get you the path to the Startup program group.
I hope this helps!
|
|
|
|
|
also in my application i also need to create an option for user to choose whether they want the option to run on start up... is that any sample code or material i can read about?
KaKaShi HaTaKe
|
|
|
|
|
Depending on your user's choice you should create or delete the shortcut in the location you get with GetFolderPath . I don't have sample code but a Google search on "creating shortcuts C#" should return what you want (as a matter of fact, the first result is a CP article that does exactly what you want.)
|
|
|
|
|
|
Hello,
I am using ReportViewer to generate report. I want my Header to be dislayed in a SubReport.
I am always getting error "SubReport could not be shown".
I am having a class ReportHeader.cs with some properties(UserName, UserDetail etc.). I want this class contents to be displayed in SubReport.
Please tell me step by step, what all i need to do ?
I have gone through so many helps available on net but i am not able to get rid of the error message.
Thanks
Gajesh
|
|
|
|