|
How to add a toolbar using windows forms programming of c#
|
|
|
|
|
|
I just created a brand new site, it's called Google. It's neat, give it a try!
Google: C# toolbar[^]
|
|
|
|
|
If i want to run code at runtime from string (Something simple)
How can i do it?
for example , i want something that does "operateThisString" function :
public int X
{
get { return this.Y * this.Z; }
}
public int Y
{
get { return (int)((Math.Sin(new Random() * 10))*52); }
}
private void button1_Click(object sender, EventArgs e)
{
string codeExpressionThatReturnInt = "return (this.X*this.Y%2);";
int numbber = operateThisString(codeExpressionThatReturnInt);
if (number == 0)
MessageBox.Show("This number is Even.");
else if(number==1)
MessageBox.Show("This number is Odd.");
}
the string codeExpression can come from the user in some way.
What is the simplest way to do it?
|
|
|
|
|
|
bonzaiholding wrote: What is the simplest way to do it?
The MSScriptControl - that would allow you to run JavaScript/VBScript dynamically. The good news is that there are lots of articles on this subject.
The bad news is that it's "old", and you'd prolly want to offer the user VB.NET or C# to extend the application. That means offering an editor, embedding the compiler, and loading the generated assembly during runtime.
This[^] article would get you started on the first technique, this[^] article if you go for the second option.
|
|
|
|
|
Can you please give me an exmaple how to do it?
|
|
|
|
|
The two links that I posted point to examples, with explanation;
MSScriptControl example is here[^], the other example is here[^].
|
|
|
|
|
Ha! The article I submitted yesterday might help with that.
Or try this[^] --
int X = 2 ;
int Y = 3 ;
PIEBALD.Types.Rational r = PIEBALD.Types.Rational.ParseInfix ( string.Format
(
"{0}*{1}%2"
,
X
,
Y
) ) ;
Then test for zero.
|
|
|
|
|
|
|
thanks,
i am using "Setup Factory 8.0" software,
Best Regards,
Saber Ahmadi
d
|
|
|
|
|
i am using c# dot net MSHTML webbrowser i have an issue if i have restrict internet security settings due to necessacity now when a web page is loading it is giving a message popups with ok button. below
"Your current security settings prohibit running ActiveX controls on this page. As a result, the page may not display correctly"
that require activex control to be installed that i not allow to install on workstation machines.
I need how if this message occur than press ok button automatically using c# code.
Any suggestion.
Affan Saied
|
|
|
|
|
Hi,
my datatable contains the following columns...
resultsView.Columns.Add("Fam.", typeof(string));
resultsView.Columns.Add("Component", typeof(int));
resultsView.Columns.Add("Description", typeof(string));
resultsView.Columns.Add("Quantity", typeof(double));
resultsView.Columns.Add("Unit", typeof(string));
resultsView.Columns.Add("Unit Price", typeof(double));
resultsView.Columns.Add("Total", typeof(double));
i have a datatable,
I use IEqualityComparer to get distinct rows.
Im able to get the distinct rows...
What my problem is If i find same rows, i need to increase a columnValue in this datatable.
I mean i have column named "component" in my datatable, so if two rows are same, then i need to get one row with component value increased by 1 using IEqualitycomparer. What i get now is only one row with component column value not increased...
cud anyone plz help me to solve this problem??
|
|
|
|
|
Please don't cross post questions.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I was not sure, whether my question comes under .net framework or c#. Thats why i posted it under both the topics.
|
|
|
|
|
Hii
i am working with windows application and i want to change the datagridview cell value's color to red color if that cell value is less than the current value which comes from a datatable or datagridview cell value's color to blue color if that cell value is greater than the current value which comes from a datatable.
plzz help me and send me code for the same
thanks in advance..
Nitin
|
|
|
|
|
this should help you
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellendedit.aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview_events.aspx
|
|
|
|
|
Clickety Police - 1[^]
Clickety Police - 2[^]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
what is this solution mean ??
|
|
|
|
|
It simply converted the URLs given to you by Coding C#, into links, to make things easier for other readers.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I have a main form 'customerForm' with a button which creates a child window 'customerPrintForm' containing a listView. So:
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;
namespace DebtManagement
{
public partial class DiaryPrintForm : Form
{
private ListViewSortManager m_sortMgr;
private System.Windows.Forms.BindingManagerBase customerBinding;
private Font colorFont;
private int indexCounter = 0;
private customerForm customerForm;
private int customerIndex;
public DiaryPrintForm(customerForm customerForm, int customerIndex)
{
InitializeComponent();
this.customerForm = customerForm;
this.customerIndex = customerIndex;
customerDataSet.Merge(customerForm.customerDataSet);
customerBinding = BindingContext[customerDataSet, "customer"];
BindingContext[customerDataSet, "customer"].Position = customerIndex;
PopulateDiaryListView();
}
private void DiaryPrintForm_Load(object sender, System.EventArgs e)
{
colorFont = new Font("Wingdings", 12f, GraphicsUnit.Point);
}
private void DiaryPrintForm_Closed(object sender, System.EventArgs e)
{
colorFont = null;
}
private void PopulateDiaryListView()
{
DateTime date = new DateTime(1970, 1, 1);
string fileToShow = "";
diaryListView.Items.Clear();
if (customerBinding.Count > 0)
{
foreach (customerDataSet.DiaryRow row in customerDataSet.customer.DefaultView[customerBinding.Position].Row.GetChildRows("customerDiary"))
{
if (row.RowState != DataRowState.Deleted)
{
customerDataSet.UsersRow user = row.UsersRowByUsersDiary;
ListViewItem item = new ListViewItem();
if (row.IsFilenameNull() != true)
{
item.ImageIndex = 0;
}
if (row.DiaryActionID.ToString() == "33")
{
if (row.DiaryDate.CompareTo(date) == 1)
{
date = row.DiaryDate;
if (row["Filename"] != DBNull.Value)
{
fileToShow = row.Filename.ToString();
}
}
}
item.SubItems.Add('\x6E'.ToString(), Color.FromArgb(row.DiaryActionRow.Color), diaryListView.BackColor, colorFont);
item.SubItems.Add(row.ManagerPriority.ToString());
item.SubItems.Add(row.UserPriority.ToString());
item.SubItems.Add(row.DiaryDate.ToString());
item.SubItems.Add(row.DiaryActionRow.Description);
item.SubItems.Add(row.Description);
item.SubItems.Add(row.IsDueDateNull() ? "" : row.DueDate.ToString());
item.SubItems.Add(row.Complete ? "Yes" : "No");
item.SubItems.Add(row.Charges.ToString("C"));
item.SubItems.Add(user.IsInitialsNull() ? "" : user.Initials);
item.SubItems.Add(row.IsNotesNull() ? "" : row.Notes);
item.SubItems.Add(row.ActionedByID.ToString());
item.SubItems.Add(row.Acknowledged.ToString());
item.SubItems.Add(row.IsLetterIDNull() ? "" : row.LetterID.ToString());
item.SubItems.Add(row.IsFilenameNull() ? "" : row.Filename.ToString());
item.SubItems.Add(user.IsFullNameNull() ? "" : user.FullName.ToString());
item.Tag = row;
diaryListView.Items.Add(item);
indexCounter++;
}
m_sortMgr = new ListViewSortManager(diaryListView,
new Type[] {
typeof(ListViewTextSort),
typeof(ListViewTextSort),
typeof(ListViewTextSort),
typeof(ListViewTextSort),
typeof(ListViewDateSort),
typeof(ListViewTextSort),
typeof(ListViewTextSort),
typeof(ListViewDateSort),
typeof(ListViewTextSort),
typeof(ListViewDoubleSort),
typeof(ListViewTextSort)
},
4, System.Windows.Forms.SortOrder.Descending);
}
if (diaryListView.SelectedItems.Count == 0 && diaryListView.Items.Count > 0)
{
diaryListView.Items[0].Selected = true;
}
}
}
}
}
However, the listView is not populating as expected (the rows are empty), although if I run my mouse over the expected date column a tooltip appears with the correct data.
Can anyone here see why this sould be please?
|
|
|
|
|
look at colorFont
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Well, I removed all colorFont references, together with the associated listView column, and this has not improved matters. I still have a 'blank' listView.
This is driving me nuts!!
|
|
|
|
|
Hmm.. I dont see any :
item.Text = "MyTitle";
or something like that.
I see only SubItems.
|
|
|
|