|
I have found the solution, in case any other guy meet with the same problem, I leave it here.
For the cell's datagridview, call Refresh() would make it.
|
|
|
|
|
Hi!
I'm building a MailMessage object containing html body with embedded images. How can I now display the content of the message with its embedded pictures in an UI control like WebBrowser?
Thank you!
|
|
|
|
|
Extract the HTML to a file in a temp folder. Then extract the images to that same folder. You may have to adjust the HTML so it points to those images correctly. Then point the WebBrowser to the HTML file you created in the temp folder.
|
|
|
|
|
There are free controls available to show html content. use that
|
|
|
|
|
I understand I can do the following to remove text from controls in this case the textbox
private void add_Button_Click(object sender, EventArgs e)
{
foreach (Control control in recordinput_groupbox.Controls)
{
if(control.GetType() == typeof(TextBox))
{
control.Text = string.Empty;
}
}
but what if they are bound? Notice the control.Databindings.clear();
that works but the problem is after I get done updating records or adding/ I want to reload the data so the user can select another item if they wish via the bindingnavigator to update. when the databinding is cleared then obviously it is no longer bound.
Is it wise to simply make a function to bind the controls back after the update or is there a easier better way of handling this? I tried to search on here and good for it but It never really addressed the per say correct way.
thanks for your time.
|
|
|
|
|
I assume you are using WPF (I could be wrong)...
I'm not quite sure what you are trying to accomplish. It sounds like you want to clear a TextBox (for example) then add the binding back to it later. Perhaps you could just change the value the TextBox.Text property is bound to (i.e., set it to an empty string)?
|
|
|
|
|
Yes it is a winform. Well, what the issue is is i can do empty.string and all is fine. However,
when the user goes to input data and hits tab to go to the next field it automatically populates with the old bound data. I don't have autocomplete enabled unless it's somehow by default.
lets say the original data for AuthorLast_Textbox is Smith
i hit add and it wipes it to the empty string that is fine. but when if i'm on Authorfirst_textbox and type in Sam and then hit tab I will automatically get smith populated in the authorlast_textbox.
I assume that is because it is databound.
thanks for your help by the way.
|
|
|
|
|
Hi All,
does the WIN32_BIOS uniquely identifies a windows box globally, even this windows box does not connect to any network.
I want to propose a licencing schema that minimise the pirating of my software.
|
|
|
|
|
If it was that simple, then everyone would do it!
There are a number of unique numbers you can get, for example Processor, NIC, HDD, and so forth, so you can generate a code sequence which will ID a PC pretty well, but you have to tie that back (normally via a website) to your system.
It is going to depend on a range of factors: How much you want to protect your software against the irritation to genuine users. What kind of users are you talking about - mass market will have hackers playing with it if it is any good, more specialised users may need less protection
For example, if I buy software, then replace my network card and have to re-install then I generally become annoyed and tend not to buy that software again. Some users don't like to connect to internet every time they try to use software - it's a privacy or a dial up issue.
You are not alone in this: Google for "unique pc identifier" and you will get millions of hits!
Sorry not to be much help, but it isn't a case of "do this and it will be ok" - it's more "how much effort will you have to put in to achieve the result you need"If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Thanks alot for your posting and actually it was quite helpful, I think i might use several hardware ids to protect my software, such as i could validate processor serial number, motherboard Id, MAC address, hard disk serial number etc. if any of these Ids can be validated, then we would say the software is geniune user. If a uses completely upgrade his/her system, then the user has to let us know.
|
|
|
|
|
|
You should probably use WMI to gather a system-specific info string, and encrypt it, and transfer the encrypted info to a database that's not on the user's machine. When the program runs, it should perform this same process, and if the encrypted string it comes up with doesn't match what's in the database, don't let the program run.
A few considerations:
0) if there is no internet connection, the program should run as it normally would if it was validated.
1) If it can't find the validation server, the program should run as it normally would if it was validated.
2) In the event that the app goes EOL or you no longer want to require remote validation, provide a method for the program to run WITHOUT checking the validation server. My suggestoion is an entry in the app.config file that tells the app not to bother checking..45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
this is indeed a good answer thanks
|
|
|
|
|
Then please vote it as a good answer. .45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
hi,
if i have already open form1, how do i check and not open form1 again??
|
|
|
|
|
i think there is property called isActiveForm, check using this. or else
while opening the form assign a golbal variable (say true), and set this to false on closing that form.
using this global variable u can validate whether the form is opened or not
|
|
|
|
|
assume if you are checking the form "form1", code is below.
public static Form IsFormAlreadyOpen(Type FormType)
{
foreach (Form OpenForm in Application.OpenForms)
{
if (OpenForm.GetType() == FormType)
return OpenForm;
}
return null;
}
private void button1_Click(object sender, EventArgs e)
{
Form frmTest;
if ((frmTest = IsFormAlreadyOpen(typeof(Form1))) == null)
{
frmTest = new Form1();
frmTest.Show();
}
else
{
frmTest.WindowState = FormWindowState.Normal;
frmTest.BringToFront();
}
} this code opens the form if it's not already open otherwise it'll make active form.
thatraja
|
|
|
|
|
hi thatraja, tks. erm i forgot to mention that i was doing it for windows mobile =). so Application.OpenForms is not available
|
|
|
|
|
If this is the same App we talked about yesterday, the list you created to show which forms need to be closed would also double up as a list of open forms wouldn't it? If it needs to be closed at log off, it's open... If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Hello I have a simple Panel class object that has a Button and Label on it.
I use the button to display an image and the label to display info on it.
It is used as a "Media Selection Tool"
The problem that I am having is when I resize the object there are cases when I will modify the object's size again.
When this is done, the code will recall the resize event again and again till its happy then exit.
Can I not prevent the resizing event till all the width and height stuff is done?
if (mode == 0)
{
this.Width = ImageButton.Width;
InfoTextBox.Visible = false;
}
For example when the above occurs, there is no infomation to be displayed therefore my object only needs to be the size of the Button to display the image.
But when "this.Width = " is executed the whole resize event gets called again.
Thank you in advance.
PS is this just sloppy code?
private void Initialize_Components()
{
this.SuspendLayout();
this.Width = 200;
this.Height = 200;
ImageButton = new Button();
InfoTextBox = new Label();
ImageButton.BackgroundImageLayout = ImageLayout.Stretch;
this.Click += new System.EventHandler(MediaIconButtonClick);
ImageButton.Click += new System.EventHandler(MediaIconButtonClick);
InfoTextBox.Click += new System.EventHandler(MediaIconButtonClick);
this.BorderStyle = BorderStyle.Fixed3D;
this.Controls.Add(ImageButton);
this.Controls.Add(InfoTextBox);
this.Resize += new System.EventHandler(this.MediaIconClass_Resize);
this.ResumeLayout(false);
this.PerformLayout();
}
public MediaIcon()
{
Initialize_Components();
}
private void MediaIconClass_Resize(object sender, EventArgs e)
{
this.SuspendLayout();
InfoTextBox.Height = this.Height;
ImageButton.Height = this.Height;
if (ImageHeight != 0)
{
ImageButton.Width = ImageButton.Height * ImageWidth / ImageHeight;
InfoTextBox.Left = ImageButton.Right;
}
else
{
ImageButton.Width = this.Width / 2;
InfoTextBox.Left = ImageButton.Right;
}
if (mode == 0)
{
this.Width = ImageButton.Width;
InfoTextBox.Visible = false;
}
else
{
InfoTextBox.Visible = true;
}
this.ResumeLayout(false);
this.PerformLayout();
}
|
|
|
|
|
You could do one or more of the following:
1) Check to see if it is already that width, and if so don't change it.
2) Remove the resize event handler at the top of a series of changes, and reinstate it just before the last one.
3) Add a bool to say "Resizing" and check it at the start of your event handler.If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Sorry for my poor English.
My Question is: How to get which group was matched after a regex.match with grouped pattern string?
for instance:
string strPattern = "\Wo*e\W|\Wt*o\W|three|four";
string strTextToSearch = "there are two apples on the table";
Regex r = new Regex(strPattern);
Match m = r.Match(strTextToSearch);
if (m.Success)
{
//how can i know it is keyword "\Wt*o\W" was matched but not the others?
}
|
|
|
|
|
newproger wrote:
Nightmare with Regular Expression
YES you're right(not left) RegExp==NIGHTMARE
I'm sorry I just feel like joking. I can't help it.
|
|
|
|
|
Groups are automatically named according to their occurance order, but you can also name them yourself (this is called "named groups"). For example, the following regular expression has three named groups:
The (?<ANIMAL>cat|dog|penguin|langolier) (?<TRANSPORT>walked|waddled|flew) down the (?<PATH>street|yellow brick road|slope)\.
|
|
|
|
|
Thanks for reply.
But in my program, the pattern string is generated at runtime(keywords inputed by user), I can't know how many keywords in design time, so I can't set fixed group name in codes.
|
|
|
|