|
There are a some rectangular controls on a winform on which a dragdrop can happen.
When an item (which has a numeric value) is dragged over any of these controls, the control should show possible result by changing its shape (Increase area by numeric value).
This should be temporary. In case i move the item it out of the control without dropping, this change should revert back. Only in case the drop is done, the change should be permanent.
Now, this effect can be achieved using DragEnter and DragLeave. Currently, I am making the modification to the Control two times by adding the changes and removing the changes.
What I want to know now is whether it is possible to save the state of control so that it can be reverted back to the old state.
In reality, the changes are complicated than just adding area into the shape. But the concept remains same. Control needs to change temporarily and a simple method to restore its state needs to be achieved.
Is it possible?
|
|
|
|
|
Hi,
I would derive new Control types that do this, so make a ReshapableButton inheriting from Button, etc. And give them a boolean Reshaped property.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
OK. This is already there. Whenever there is a DragLeave event, the control checks if it was reshaped and then it draws itself once again after making changes back.
My question is how to save the details of control during DragEnter which can be easily resumed at DragLeave.
Serialization could be one solution. However implementing that within a class to handle itself, seems a bit tricky. Forms cannot be serialized easily.
So, basically I need a control that can save its state by serializing itself. When needed, it resumes from the serialized data. The fact that the control is on UI thread and it has to be a self managed code makes it tricky. I just need a clue how to implement this.
|
|
|
|
|
Hi,
I am looking for a " student tracking system" project using c#.net and sql server.
Let me know if there is any useful links.
Regards,
Savitha
|
|
|
|
|
savitha87k wrote: I am looking for a " student tracking system" project using c#.net and sql server.
Stop looking and start coding
savitha87k wrote:
Let me know if there is any useful links.
We are not here to find exsisting project. We are here to help for a specific code problem
Edit: typo
|
|
|
|
|
Hi,
I want to delete the duplicate and some hard coded XML node in XMLDocument throgh C#.
What is the method to do the same?
I am new to the use of XML in C#.
Please help me out.....!!!!!!!!!!!
Thanks
|
|
|
|
|
|
Hi,
There are some addresses as follows :
http:
I'm gonna select rs320tl.rapidshare.com with Regex , but I'm not familiar with Regular Expressions.
Would you please guide me ?
Thanks.
PS.
rs320tl in the address is variable.
|
|
|
|
|
^(ftp|http|file):
so
http :
1 2 3 4
so the reg expression would spit out
$1 = http
$2 = www.codeproject.com
$3 = /forum
$4 = /xxx.html
hope this helps.
|
|
|
|
|
Thanks,
How can I store $2 in a string?
|
|
|
|
|
string str = (new Regex("the pattern")).Match("the string").Groups[2].Value;
|
|
|
|
|
It doesn't work with www.codeproject.com
|
|
|
|
|
Try this instead of a Regex:
MessageBox.Show((new Uri("http://rs320tl.rapidshare.com/files/119371167/sth.rar")).Host);
|
|
|
|
|
I didn't know that a Uri broke it down for you - thanks for that! You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Under which namespace .host is come
|
|
|
|
|
I think you mean Uri. It's in the System namespace.
|
|
|
|
|
Thanks, but it throws an Exceptions on
MessageBox.Show((new Uri("rs320tl.rapidshare.com")).Host);
|
|
|
|
|
Try this:
MessageBox.Show((new UriBuilder("rs320tl.rapidshare.com")).Host);
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ClassLibrary;
using System.Collections;
namespace OrderForm
{
public partial class SubForm : Form
{
private TreeView s;
private ComboBox h;
Product c = new Product ();
private double[] prices = new double[100];
Store[] bee = new Store[100];
private string[] quantumItems = new string[4];
private double [] updatePrices = new double[3];
public SubForm()
{
InitializeComponent();
}
public SubForm(ComboBox h,TreeView s)
{
InitializeComponent();
h = new ComboBox();
s = new TreeView();
this.h = h;
this.s = s;
}
public ComboBox superSweet
{
get
{
return h;
}
set
{
h = value;
}
}
public TreeView superAwesome
{
get
{
return s;
}
set
{
s = value;
}
}
private void button2_Click(object sender, EventArgs e)
{
h.Items.Add(txtProduct.Text);
this.Close();
}
private void price_one_TextChanged(object sender, EventArgs e)
{
bee[1] = new Store();
string itemTwo = price_one.Text;
double ItemTwoConvert = Convert.ToDouble(itemTwo);
bee[1].superprice=ItemTwoConvert;
}
private void price_two_TextChanged(object sender, EventArgs e)
{
bee[2] = new Store();
string itemOne = price_two.Text;
double ItemOneConvert = Convert.ToDouble(itemOne);
bee[2].superprice = ItemOneConvert;
}
private void price_three_TextChanged(object sender, EventArgs e)
{
bee[3] = new Store();
string itemThree = price_three.Text;
double itemThreeConvert = Convert.ToDouble(itemThree);
bee[3].superprice = itemThreeConvert;
}
private void button1_Click(object sender, EventArgs e)
{
store_three.Visible = true;
price_three.Visible = true;
}
private void SubForm_Load(object sender, EventArgs e)
{
}
private void txtProduct_TextChanged(object sender, EventArgs e)
{
c = new Product();
c.supername = txtProduct.Text;
c.supercategory = cmbCat.SelectedText;
}
public void myAwesomeItem(string nice,string item,string item3, string item4,string item5, string item6)
{
txtProduct.Text = nice;
cmbCat.Text = item;
store_one.Text = item3;
store_two.Text = item4;
price_one.Text = item5;
price_two.Text = item6;
}
}
}
How would I keep what changes the user makes to the default values?
|
|
|
|
|
Wrap your code in a PRE blocks and specify the language. For example, if I type this into the message editor:
<pre lang="C#">public class MyClass
{
public void MyFunction()
{
MessageBox.Show("Hello");
}
}</pre>
It comes out looking like this:
public class MyClass
{
public void MyFunction()
{
MessageBox.Show("Hello");
}
}
|
|
|
|
|
Nexusfactor wrote: How would I keep what changes the user makes to the default values?
Quote Selected Text
By writing a logic. You could keep default values within another class. and then compare it if needed.
Also please edit your post as aspdotnetdev said it
|
|
|
|
|
|
I see you have created a new login to ask the same question again. And you still posted a link to the code rather than posting the code in your message.
Don't create redundant logins unnecessarily.
Don't repost the same question.
Don't post links to code. Post the code here in your message. Format it well. Make a minimal example instead of posting your full code.
|
|
|
|
|
I have made a contact me form for my website. When I was testing it with f5 in ASP.Net, the contact me page just reloaded itself after I submitted the information (like the Name, Phone Number, Email etc). But I still received the email containing the information I inputted into the Text Boxes in the Form.
So I decided to include a Try-Catch and redirect to a failure or success page depending on if it sent successfully... it always redirected to failure.html but I still received the email which is weird.
So I decided to FTP the site, it still redirects to failure.html but I don't receive any email anymore. There is clearly a problem here. I get no errors and no exception etc, so I have no indication onto where I'm going wrong. I will include all my coding.
contactme.aspx (just the form):
<div runat="server" id="form01">
<table width="325" border="0">
<tr>
<td height="30" class="left"><asp:label runat="server" for="name">Name:</asp:label></td>
<td>
<asp:TextBox runat="server" class="input" type="text" name="name" id="name"></asp:TextBox></td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="name" ErrorMessage="Please input your name.">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td height="30" class="left"><asp:label runat="server" for="number">Number:</asp:label></td>
<td><asp:TextBox runat="server" class="input" type="text" name="number" id="number"></asp:TextBox></td>
<td> </td>
</tr>
<tr>
<td height="30" class="left"><asp:label runat="server" for="email">Email:</asp:label></td>
<td><asp:TextBox runat="server" class="input" type="text" name="email" id="email"></asp:TextBox></td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="email" ErrorMessage="Please input an email address.">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="email" ErrorMessage="Please enter a valid email address."
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="left"><asp:label runat="server" for="message">Message:</asp:label></td>
<td>
<asp:TextBox runat="server" class="input" name="essage" id="message" cols="45"
rows="3" TextMode="MultiLine"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="message" ErrorMessage="Please input a message.">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="left"> </td>
<td class="right"><label>
<asp:button runat="server" class="submitBtn" name="submit"
Text="Submit" id="cmdSubmit" onclick="submit_Click" /> <asp:ValidationSummary
ID="ValidationSummary" runat="server" CssClass="rightSpec"
DisplayMode="List" />
</label>
</td>
</tr>
</table>
</div>
contactme.aspx.cs:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net.Mail;
public partial class contactme : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void submit_Click(object sender, EventArgs e)
{
MailMessage messageC = new MailMessage();
MailAddress to = new MailAddress("webdesign@malachijones.co.uk");
messageC.To.Add(to);
messageC.From = new MailAddress("webdesign@malachijones.co.uk", "site request");
messageC.Subject = "malachijones.co.uk website request";
messageC.IsBodyHtml = true;
messageC.Body = "<html><head></head><body>" +
"<p></p>" +
"<p><strong>Name:</strong> " + name.Text + "</p>" +
"<p><strong>Phone Number:</strong> " + number.Text + "</p>" +
"<p><strong>Email Address:</strong> " + email.Text + "</p>" +
"<p><strong>Message:</strong> " + message.Text + "</p>" +
"</body></html>";
SmtpClient smtpClient = new SmtpClient("smtpout.europe.secureserver.net");
smtpClient.Credentials = new System.Net.NetworkCredential("webdesign@malachijones.co.uk", "My Password");
smtpClient.Send(messageC);
}
}
web.config:
<system.net>
<mailSettings>
<smtp from="webdesign@malachijones.co.uk">
<network host="smtpout.europe.secureserver.net" port="25" userName="webdesign@malachijones.co.uk" password="My Password"/>
</smtp>
</mailSettings>
</system.net>
Thanks in advance for any help.
Respect,
(*$malli$*)modified on Thursday, February 18, 2010 7:35 PM
|
|
|
|
|
No one is going to read this unformatted garbage
Read
this[^] and pay attention to item #7 I know the language. I've read a book. - _Madmatt
|
|
|
|