|
I edited the Project file to add the Reference <Reference Include = "System.Management.Automation> to add the reference for powershell
I am using a Windows 7 machine with the Group policy tools installed
the first invoke command I had in a try/catch and I am not getting a runspace exception, but I just found that I am getting an exception, my try/catch testing before must have been too targeted. I just added a catch for any exception and found that I am Command not found exception.
I am going to assume that I have added the wrong powershell resource and once i find the correct one I will have my problem fixed.
|
|
|
|
|
according to this MSDN article http://msdn.microsoft.com/en-us/library/ff458115(v=vs.85).aspx the assembiles are in c:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\V1.0 but when I add these as a reference I get the same unknown command when trying to add the Grouppolicy module
any ideas why this is not working?
|
|
|
|
|
First step in mixed language programming is to create the functionality, at least a framework, in one language. In your case create a PowerShell script first that runs only as a PowerShell script.
Other than that several things as pure guesses.
1. Invoke starts a process. It might be the case that you shouldn't be invoking until everything is in place.
2. AddScript/AddCommand returns a PowerShell instance. That suggests to me that it might be acting like String.Replace() in that the original instance does not have the command.
|
|
|
|
|
my issues seem to be that I am doing something incorectly to load the Group policy Powershell module. I am calling invoke after the import-Module command so I can call a cmdlet that is not loaded until the Group policy Module has been loaded. I am getting an exception on the import-Module command that it can't be found so either I am calling the wrong powershell classes or I am setting up my runspace incorectly.
|
|
|
|
|
How to manage the ComboBox in QueryPanel
|
|
|
|
|
How indeed! Do you have an actual question?
I must get a clever new signature for 2011.
|
|
|
|
|
My question is how to make the ComboBox Control relate to a database when it runs,Then make some
data in the database as the item of ComboBox.At last click the query button to researh the datas based on them.
Besides I have another question about RapidWebDev.How to add a new user use Membership make me so confused.It Beeps me error when I create a new user with CreateUserWizard control.
|
|
|
|
|
xaq693888265 wrote: My question is how to make the ComboBox Control relate to a database when it runs
You need to extract whatever records you need from the database, and add them to your combobox.
xaq693888265 wrote: Then make some data in the database as the item of ComboBox.
This is the reverse of the above, just add the selected item to your database.
xaq693888265 wrote: At last click the query button to researh the datas based on them.
I am not sure what you mean by this, but I suspect you will need to write some code that is activated by a button.
xaq693888265 wrote: How to add a new user use Membership
I expect you will find the answer to this question here[^].
I must get a clever new signature for 2011.
|
|
|
|
|
I'm sorry for my bad English.First,there's a table exsit in the database.the ComboBox is established in the QueryPanel of RapidWebDev.For a example:
there's a database named Machine,and a table named MachineAdress:
MachineAdress as follows:
MachineID Adress
Gaj001 hongshan
GAJ002 Japan
then Gaj001 and GAJ002 will be the items of ComboBox when the soft runs.
there's a attributes named "DynamicDataSource" in the ComboBox of the RapidWebDev.how to configuration the attributes to meet my request?
Do you understand what I mean?
|
|
|
|
|
xaq693888265 wrote: then Gaj001 and GAJ002 will be the items of ComboBox when the soft runs.
Then you need to extract those items from the database and add them to the ComboBox. If RapidWebDev provides an automated way to achieve this then you can use it, otherwise you will need to do it manually by writing some code.
xaq693888265 wrote: Do you understand what I mean?
Yes I understand what you mean but I have no background in RapidWebDev. As has been suggested before you should look at the documentation on the RapidWebDev site for guidance.
I must get a clever new signature for 2011.
|
|
|
|
|
As this is a codeplex project, you should probably ask any questions you have about it there[^]. That's where the expertise will be found on it.
|
|
|
|
|
I'm sorry ,It's mine.how to make the ComboBox relate to a database and then makse some of datas in the database become the items of ComboBox.At last,click the query button to research.Is this
OK?Do you understand what I want to do?
|
|
|
|
|
Are there application design and development articles with sources, which illustrate how to design and develop typical applications (GUIs, databases, etc...) according to design patterns as in:
Robert C Martin "Agile Principles, Patterns and Practices in C#"
Erich Gamma "Design Patterns: Elements of Reusable Object-Oriented Software"
Чесноков
|
|
|
|
|
Yes: a quick Google should locate vast numbers of tutorials.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Hmmm, have you tried Code Project.
I hear some good things about them.
Seriously, look in the Article Archives and there is just about all you need.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC League Table Link
CCC Link[ ^]
|
|
|
|
|
Yes, but we won't do all the work for him...
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
|
First, this is a volunteer effort. The regulars who come here to answer questions do so on THEIR time, not yours. If you want answers to your questions on your schedule, call up Microsoft and pay for the support.
What you just did with your post here is extremely rude.
|
|
|
|
|
create an event for the gridview like so;
private void dgv_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
//runs when the mouse is clicked over a cell
if (e.RowIndex > -1 && e.ColumnIndex > -1)
{
if (e.Button == MouseButtons.Left)
{
//single-click left mouse button
if (dgv.SelectionMode != DataGridViewSelectionMode.CellSelect)
{
dgv.SelectionMode = DataGridViewSelectionMode.CellSelect;
int row = dgv.CurrentCell.RowIndex;
int col = dgv.CurrentCell.ColumnIndex;
}
}
textbox.text=dgv.Rows[row].Cells[col].Value.ToString();
}
Remeber to Create the same event in the Form.Designer.cs file for the Datagridview.
Hope this Helps
|
|
|
|
|
Hi Enobong Adahada
thanks for replying to my message, I have managed to work around my code refering to the question I posted yesterday
but for some reason its not getting the cell value number to display it in the button.
If you dont mind please you can have a look my question (under the View Unanswered Question) provided with sample of code
and tell me if I missing something....
Thanks in advance
kind regards
roni
|
|
|
|
|
Can you post the code u are using so i can
see if there are logic bugs.
|
|
|
|
|
Here is the code...
I have two forms on my project (Form1 & Form2).
-In Form1 I have two Buttons (Starter & Main). Both these buttons on click event, they call database sql-query and genereate into form the records as Buttons.
-In Form2 I have a Button (Starter) and DataGridView. Also this button on click event calls database sql-query and generates records in DatagridView. DataGridView has four columns:
(Note: On columns [0] and [1] data are genereated from database, the columns [2] and [3] are template columns genereated at run-time also filled with data at run-time)
Now in Form2 when I double_click inside the Cell under the Qty In Stock column, a dialog-box pops up and allows me to enter the number in to that particular cell. Lets say Row-1: like so...
FoodName FoodType Qty In Stock Status
-----------------------------------------------------------
Soup Starter 10 Allways On Stock
Based on this: How can I take the value of that cell = 10 and dispalyit on the bottom-right corner of the Button (in this case button Soup). This is what the Soup Button should look like (in Form1): (Note: The Button called Soup is generated from database...)
##############
# Soup #
# 10 #
##############
Here is the code of dataGridView1_CellClick event (in Form2)...
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 2)
{
string cellContent = "0";
if (this.dataGridView1[e.ColumnIndex, e.RowIndex].Value != null)
{
cellContent = this.dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString();
}
using (InputBox ib = new InputBox("Enter new stock amount:", this.dataGridView1[0, e.RowIndex].Value.ToString(), cellContent))
{
if (ib.ShowDialog() == DialogResult.OK)
{
this.dataGridView1[e.ColumnIndex, e.RowIndex].Value = ib.Result;
cellContent = ib.Result;
}
}
}
}
This is the code of InputBox dialog where it allows me to enter quantity in to the Cell of dataGridView1...
public partial class InputBox : Form
{
public InputBox(string text, string caption, string defaultValue)
{
InitializeComponent();
this.Text = caption;
Size size;
using (Graphics g = this.CreateGraphics())
{
Rectangle screen = Screen.PrimaryScreen.WorkingArea;
SizeF sizeF = g.MeasureString(text, lblPrompt.Font, screen.Width - 20);
size = sizeF.ToSize();
size.Width += 4;
}
if (size.Width < 310)
{
size.Width = 310;
}
Size clientSize = this.ClientSize;
clientSize.Width += size.Width - lblPrompt.Width;
clientSize.Height += size.Height - lblPrompt.Height;
this.ClientSize = clientSize;
lblPrompt.Text = text;
txtResult.Text = defaultValue;
this.DialogResult = DialogResult.Cancel;
}
void CancelButtonClick(object sender, System.EventArgs e)
{
result = null;
this.Close();
}
void AcceptButtonClick(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
result = txtResult.Text;
this.Close();
}
string result;
public string Result
{
get
{
return result;
}
}
private void btnSeven_Click(object sender, EventArgs e)
{
txtResult.Text += btnSeven.Text + "7";
}
private void btnTwo_Click(object sender, EventArgs e)
{
txtResult.Text += btnTwo.Text + "2";
}
private void btnOne_Click(object sender, EventArgs e)
{
txtResult.Text += btnOne.Text + "1";
}
private void btnSix_Click(object sender, EventArgs e)
{
txtResult.Text += btnSix.Text + "6";
}
private void btnFive_Click(object sender, EventArgs e)
{
txtResult.Text += btnFive.Text + "5";
}
private void btnFour_Click(object sender, EventArgs e)
{
txtResult.Text += btnFour.Text + "4";
}
private void btnNine_Click(object sender, EventArgs e)
{
txtResult.Text += btnNine.Text + "9";
}
private void btnEight_Click(object sender, EventArgs e)
{
txtResult.Text += btnEight.Text + "8";
}
private void btnThree_Click(object sender, EventArgs e)
{
txtResult.Text += btnThree.Text + "3";
}
private void btnZero_Click(object sender, EventArgs e)
{
txtResult.Text += btnZero.Text + "0";
}
private void btnClear_Click(object sender, EventArgs e)
{
txtResult.Clear();
txtResult.Focus();
}
}
This is the code how to create Buttons on Form1, and then take the database records and asign values to these buttons...
private void FoodAddButtons(DataTable table)
{
int xpos = 5;
int ypos = 5;
int space = 2;
VistaButtonTest.VistaButton newButton = null;
DtposMenuBS.Sort = "FoodPrice";
try
{
foreach (DataRowView dr in DtposMenuBS.List)
{
newButton = new VistaButtonTest.VistaButton();
newButton.ButtonText = dr["FoodName"].ToString();
newButton.AutoEllipsis = true;
newButton.Width = 152;
newButton.Height = 70;
newButton.CornerRadius = 4;
newButton.Font = new System.Drawing.Font("Arial Narrow", 15.00F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
newButton.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
newButton.ForeColor = System.Drawing.Color.Black;
newButton.HighlightColor = System.Drawing.Color.DarkGray;
newButton.GlowColor = System.Drawing.Color.DimGray;
if (xpos + newButton.Width > this.FoodMenuPanel.ClientSize.Width)
{
ypos += newButton.Height + space;
xpos = 5;
}
newButton.Location = new Point(xpos, ypos);
xpos += newButton.Width + space;
newButton.Click += ItemSelection1;
this.FoodMenuPanel.Controls.Add(newButton);
}
}
finally
{
DtposMenuBS.Sort = "";
}
}
|
|
|
|
|
Reason for my vote of 1: Why cut and paste that lot? Why did you not just give a link to your Q&A question? Now, you have two places with the same info, that potentially could duplicate work if anyone does answer.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
LAPEC wrote: no one seems to answer my question
There could be a number of reasons for that:
1) No body knew the answer.
2) No body could be bothered to work out what the question was, because of the large lump of code they didn't want to bother with.
3) You didn't seem to have shown much effort in working on your problem yourself.
4) Some combination of the above.
You have to remember: not everybody looks at Q&A; nobody here gets paid for this; most of us have jobs which do pay and expect a certain amount of work from us.
You aren't helping yourself by taking a whining, petulant tone in your "bump" message...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
LAPEC wrote: I thought that the Code Project Forum is there for people to help who dont have much knowledge on programming...
It's a forum, people meet. Sometimes they help each other, but being a member is no replacement for an education.
I are Troll
|
|
|
|