|
First, what does this have to do with Windows Forms?
Second, you do realize that NTFS already has the encryption engine built into it, right?
As for your problem, it sounds as though you're putting your encryption driver above NTFS instead of below it (close to the disk). You should be encrypting/decrypting disk sectors as written/read instead of trying to encrypt file streams of various types.
|
|
|
|
|
Hi
I've a problem creating a window form application. Can i modify the connectionstring(in app.config) at runtime ??
There is a Form with a textbox in wich user may type the "connection string" and this new "connectionstring" should be written in the app.config file.
Thanks in advance
sorry for the bad english
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
Yes you can. Something like
appSettingSection->Settings[key]->Value = newValue;
Ger
|
|
|
|
|
hi Ger
how to save the changes??
thanks for the answer
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
Your config class will have a 'save' event that you can use. See Chapter 9 of Pro Visual C++/CLI and the .NET 3.5 Platform by Stephen Harper from Apress. I find it an excellent resource
Ger
|
|
|
|
|
Hi All,
I have projectinstaller class for my windows service in C#.Net, my windows service is hosting a WCF service in it. When I run the instalutil command on the command prompt.
Its throwing the below exception, what could be the reason for this. I am unable to start the service at all. Can any body please help me in this? Any sort of link or any help
would be greatly appreciated.
An exception occurred during the Rollback phase of the CalculatorWindowsServiceAppl.ProjectInstaller installer.
System.ArgumentException: The savedState dictionary does not contain the expected values and might have been corrupted.
An exception occurred during the Rollback phase of the installation. This exception will be ignored and the rollback will
continue. However, the machine might not fully revert to its initial state after the rollback is complete.
protected override void OnBeforeInstall(IDictionary savedState)
{
serviceInstaller1.ServiceName = "CalculatorWindowsService";
base.OnBeforeInstall(savedState);
String username = GetContextParameter("username");
String password = GetContextParameter("password");
String account = GetContextParameter("account");
if (!String.IsNullOrEmpty(username))
serviceProcessInstaller1.Username = username;
if (!String.IsNullOrEmpty(password))
serviceProcessInstaller1.Password = password;
serviceProcessInstaller1.Context.LogMessage("Any Thing");
}
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
modified on Friday, January 21, 2011 5:31 PM
|
|
|
|
|
Please refer this[^]. Hope it helps.
|
|
|
|
|
Hi
I want to create a c# program and i have a question:
How can I end a process that running in CPU?
Thanks.
|
|
|
|
|
Get it's Process instance from Process.GetProcessByName (or whatever your need requires) and call its CloseMainWindow method, or (more risky) its Kill method.
Process class docs[^]
|
|
|
|
|
just to kill the process.
BOOL TerminateProcess(
HANDLE hProcess,
UINT uExitCode);
when a process that running in CPU,i don't think we can end it.You just need to use the TerminateProcess function,then the system will end it.
|
|
|
|
|
hi
i am using vs.net 2005 C# to load a excel file into a window form webbrowser control in a window form, however i notice that when i navigate the excel into the webbroser the excel.exe application is actually hidden in the background, which i am fine with, but when i try to open another excel file it always loads into the already opened but hidden application, which means while the webbrowser is displaying excel file A, i cant open another excel file B .
is there any way to work around this?
|
|
|
|
|
Hi Guys,
I am having an issue with the Windows User Contol communication. I am creating a winform application. I have a tree view in the page (UC1). I am populating data to that from DB. on the leaf node select, i have to call an even in a Grid (User Control2) which will populate the data depending on the selection of the treenode text. Here the Tree & Grid are usercontrols. I have tried to use events for doing the same. But there are issue, If any one can help me, i will be thankful to them
Hi Guys,
Thanks for your response. This is what i am trying to do.
GridUser Control.cs
public partial class LogGridViewUserControl : UserControl
{
public delegate void Data_Bind(object sender, LogGridEventArgs e);
public event Data_Bind dataBindHandler;
public LogGridViewUserControl()
{
InitializeComponent();
}
public void OnDataBind(Object sender, LogGridEventArgs e)
{
if (dataBindHandler != null)
{
string str = CallBusiness(e.Connection);
}
}
}
public class LogGridEventArgs
{
public string Connection { get; set; }
public LogGridEventArgs(string connection)
{
Connection = connection;
}
}
TreeUserControl.cs
public partial class TestTreeControl : UserControl
{
public TestTreeControl()
{
InitializeComponent();
// BuilTree()
}
private void trvTest_NodeSelect(object sender, TreeViewEventArgs e)
{
if (e.Node.Nodes.Count == 0)
{
I need to call the OnDataBind event in the Grid to populate the data in the Grid
}
}
}
In the main form, i will add the both user controls. How do i call the OnDataBind evnthandler of the GridView when a node selection is changed in the treeview. I am not an expert in the Winform development/ not so good with delegates. If any one can chip in, it will be of great help to me.
Thanks
Tutu
|
|
|
|
|
I'm not quite sure what you want but I think you may have it the wrong way around. Try creating a NodeSelected event in the TestTreeControl control and then fire the event where you need to call the OnDataBind method.
Then in the main form subscribe to that event (see pseudo code below)
MyTestTree.NodeSelected += new NodeSelectedDelegateHandler(MyTestTree_NodeSelected);
void MyTestTree_NodeSelected(object source, LogGridEventArgs e)
{
MyLogGridViewUserControl.OnDataBind(source, e);
}
Also your LogGridEventArgs class should inherit from EventArgs
Cheers
Architecture is extensible, code is minimal.
|
|
|
|
|
Hello,
I need to develop a WinForm application which can play .mp3 music files.
I want to have complete control over the UI - no visibly embedded Media Player if possible.
I also need to be able to programatically stop/play/pause/resume/change volume/change songs.
Any ideas on how to do this?
Thanks,
Roy.
|
|
|
|
|
This[^] video might help you.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
Hi,
Thanks for the link. it helped.
|
|
|
|
|
hi i am using vs 2005 c# to make a simple window form which can load an excel file INTO the window form. and then manipulating the loaded excel with interlop
i have tried using webbrowser at How to Integrate Excel in a Windows Form Application using the WebBrowser[^]
however instead of loaded into the webbrowser it always open into the whole file instead of into the webbrowser.
does anyone mind suggesting an alternative or how to solve the webbrowser problem?
|
|
|
|
|
|
prerakpatel wrote: How to Integrate Excel in a Windows Form Application using the WebBrowser[^]
He already define this link and searching how to recover from problem which occur in WebBrowser.
|
|
|
|
|
neodeaths wrote: does anyone mind suggesting an alternative
Here[^] it is
I are Troll
|
|
|
|
|
Hi folks.
I need a little inspiration.
I want to program a Windows program that can display a calendar in the desktop background. It should be possible to interact with this calendar (add appointments etc).
I know there are other programs that do this very well (eg. Active Desktop Calendar http://www.xemico.com/adc/) but my program must have some other features than the alternatives currently on the market.
I plan to make it an open source project.
My biggest problem is how to go about it grapples with creating an interactive desktop background? Anyone who has tried it or have experience with something similar? Possibly a link to some guides, or some API names that I should look at?
I have experience in C #, C + +, C, Java, Visual Basic. But I am also willing to look at another programming language if it can solve my problem in a better way. I'm not looking for a sidebar solution.
Hope you can help.
|
|
|
|
|
hansdam wrote: or some API names that I should look at?
SetWindowPos with HWND_BOTTOM
I are Troll
|
|
|
|
|
I have my filtered combo boxes working in a datagridview thanks to a Linda Liu sample. Now when I enter a row I want to see the data from a row in a sequence of text boxes below the grid - but for the combo boxes I only see the index, when I would prefer to see the information e.g. route description. Here is a cutdown version of From1.h:
namespace DataGridViewComboEx5 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Collections::Generic;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::IO;
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::DataGridView^ gridPassenger;
private: System::Windows::Forms::DataGridViewComboBoxColumn^ dgRoute;
private: System::Windows::Forms::DataGridViewComboBoxColumn^ dgStage;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ dgPerson;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ lblPerson;
private: System::Windows::Forms::Label^ lblStage;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Label^ lblRoute;
private: System::Windows::Forms::Label^ label5;
:
:
ref class ViewPassengerData
{
private:
int m_Route;
int m_Stage;
String ^m_Person;
public:
ViewPassengerData(int Route, int Stage, String^ Person)
{
m_Route = Route;
m_Stage = Stage;
m_Person = gcnew String(Person);
}
property int RouteID
{
int get()
{
return m_Route;
}
void set(int value)
{
m_Route = value;
}
}
property int StageID
{
int get()
{
return m_Stage;
}
void set(int value)
{
m_Stage = value;
}
}
property String^ Person
{
String^ get()
{
return m_Person;
}
void set(String^ value)
{
m_Person = value;
}
}
};
private:
List<ViewPassengerData^> ^m_DataList;
DataSet ^RouteStages;
DataTable ^dtRoute;
DataTable ^dtStages;
BindingSource ^bsRoute;
BindingSource ^childBS;
BindingSource ^filteredStages;
bool m_LoadComplete;
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
m_LoadComplete = false;
RouteStages = gcnew DataSet();
dtRoute = gcnew DataTable("dtRoute");
dtStages = gcnew DataTable("dtStages");
bsRoute = gcnew BindingSource();
childBS = gcnew BindingSource();
filteredStages = gcnew BindingSource();
DataColumn ^col = gcnew DataColumn("RouteID", int::typeid);
dtRoute->Columns->Add(col);
col = gcnew DataColumn("RouteDescription");
dtRoute->Columns->Add(col);
col = gcnew DataColumn("StageID", int::typeid);
dtStages->Columns->Add(col);
col = gcnew DataColumn("StageDescription");
dtStages->Columns->Add(col);
col = gcnew DataColumn("RouteID", int::typeid);
dtStages->Columns->Add(col);
RouteStages->Tables->Add(dtRoute);
RouteStages->Tables->Add(dtStages);
DataRow ^row = RouteStages->Tables["dtRoute"]->NewRow();
row[0] = 3;
row[1] = "Route 3";
RouteStages->Tables["dtRoute"]->Rows->Add(row);
row = RouteStages->Tables["dtRoute"]->NewRow();
row[0] = 2;
row[1] = "Route 2";
RouteStages->Tables["dtRoute"]->Rows->Add(row);
row = RouteStages->Tables["dtStages"]->NewRow();
row[0] = 44122;
row[1] = "Stage 1";
row[2] = 3;
RouteStages->Tables["dtStages"]->Rows->Add(row);
row = RouteStages->Tables["dtStages"]->NewRow();
row[0] = 53404;
row[1] = "Stage 2";
row[2] = 3;
RouteStages->Tables["dtStages"]->Rows->Add(row);
row = RouteStages->Tables["dtStages"]->NewRow();
row[1] = "Stage A";
row[2] = 2;
row[0] = 60601;
RouteStages->Tables["dtStages"]->Rows->Add(row);
row = RouteStages->Tables["dtStages"]->NewRow();
row[0] = 94105;
row[1] = "Stage B";
row[2] = 2;
RouteStages->Tables["dtStages"]->Rows->Add(row);
bsRoute->DataSource = RouteStages;
bsRoute->DataMember = "dtRoute";
childBS->DataSource = RouteStages;
childBS->DataMember = "dtStages";
filteredStages->DataSource = RouteStages;
filteredStages->DataMember = "dtStages";
this->dgRoute->DataSource = bsRoute;
this->dgRoute->DisplayMember = "RouteDescription";
this->dgRoute->ValueMember = "RouteID";
this->dgStage->DataSource = childBS;
this->dgStage->DisplayMember = "StageDescription";
this->dgStage->ValueMember = "StageID";
DataTable ^dtViewPassengerData = gcnew DataTable("ViewPassengerData");
dtViewPassengerData->Columns->Add("RouteID", Int32::typeid);
dtViewPassengerData->Columns->Add("StageID", Int32::typeid);
dtViewPassengerData->Columns->Add("Person", String::typeid);
DataRow ^dr = dtViewPassengerData->NewRow();
dr["RouteID"] = 3;
dr["StageID"] = 44122;
dr["Person"] = "Thomas";
dtViewPassengerData->Rows->Add(dr);
dr = dtViewPassengerData->NewRow();
dr["RouteID"] = 2;
dr["StageID"] = 60601;
dr["Person"] = "Edward";
dtViewPassengerData->Rows->Add(dr);
gridPassenger->AutoGenerateColumns = false;
gridPassenger->DataSource = dtViewPassengerData;
gridPassenger->Columns[0]->DataPropertyName = "RouteID";
gridPassenger->Columns[1]->DataPropertyName = "StageID";
gridPassenger->Columns[dgPerson->Index]->DataPropertyName = "Person";
m_LoadComplete = true;
}
private: System::Void gridPassenger_CellValueChanged(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e) {
if ((e->ColumnIndex == dgRoute->Index)
&&(e->RowIndex>= 0))
{
if (gridPassenger->DataSource->GetType() == DataTable::typeid)
{
gridPassenger->Rows[e->RowIndex]->Cells[dgStage->Index]->Value = DBNull::Value;
}
else
{
gridPassenger->Rows[e->RowIndex]->Cells[dgStage->Index]->Value = nullptr;
}
}
}
private: System::Void gridPassenger_DataError(System::Object^ sender,
System::Windows::Forms::DataGridViewDataErrorEventArgs^ e) {
if (e->ColumnIndex != dgStage->Index)
{
MessageBox::Show("Data error occurs:" + e->Exception->Message);
}
}
private: System::Void gridPassenger_EditingControlShowing(System::Object^ sender, System::Windows::Forms::DataGridViewEditingControlShowingEventArgs^ e) {
if (this->gridPassenger->CurrentCell->ColumnIndex == dgStage->Index)
{
DataGridViewComboBoxEditingControl ^control = dynamic_cast<DataGridViewComboBoxEditingControl^>(e->Control);
BindingSource ^bs = dynamic_cast<BindingSource^>(control->DataSource);
if (bs != nullptr)
{
(dynamic_cast<ComboBox^>(e->Control))->DataSource = filteredStages;
Object ^Routevalue = this->gridPassenger->Rows[this->gridPassenger->CurrentCell->RowIndex]->Cells[dgRoute->Index]->Value;
if (Routevalue == DBNull::Value || Routevalue == nullptr)
{
filteredStages->Filter = "RouteID=-1";
}
else
{
filteredStages->Filter = "RouteID=" + Routevalue->ToString();
}
if (this->gridPassenger->CurrentCell->Value != DBNull::Value
&& this->gridPassenger->CurrentCell->Value != nullptr)
{
control->SelectedValue = this->gridPassenger->CurrentCell->Value;
}
}
} }
private: System::Void gridPassenger_RowEnter(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e) {
if (m_LoadComplete&& e->RowIndex < gridPassenger->RowCount)
{
lblPerson->Text = gridPassenger->Rows[e->RowIndex]->Cells[dgPerson->Name]->Value->ToString();
lblRoute->Text = gridPassenger->Rows[e->RowIndex]->Cells[dgRoute->Name]->Value->ToString();
lblStage->Text = gridPassenger->Rows[e->RowIndex]->Cells[dgStage->Name]->Value->ToString();
}
}
};
}
Ger
modified on Wednesday, December 8, 2010 11:44 PM
|
|
|
|
|
When you have code like this, please wrap the block of code in a <pre> </pre> tags. It makes it easier to read.
|
|
|
|
|
Done - wasn't aware of them - and I've chopped out much of the autogenerated code.
Ger
Ger
|
|
|
|