|
My English very bad. exactly is extend.
|
|
|
|
|
Have a look at the Application Auto-update via Online Files in C#[^] article.
Within in it I use a progress bar to show the progress of a download from an ftp site.
Have a look at the Bytesdownloaded method within Form1.cs of the Update application if you want to get to the nitty gritty.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Hello Guys,
My Code:
private void button3_Click(object sender, EventArgs e)
{
FileInfo msiFile = new FileInfo(@"C:\temp\WinInstaller\Sample.msi");
WindowsInstaller.Installer inst = (WindowsInstaller.Installer)new Installer();
Database instDb = inst.OpenDatabase(msiFile.FullName, WindowsInstaller.MsiOpenDatabaseMode.msiOpenDatabaseModeTransact);
WindowsInstaller.View view = instDb.OpenView("DELETE FROM `Registry` WHERE `Registry`.`Root`='1'");
view.Execute(null);
view.Close();
instDb.Commit();
}
Am trying to delete a row in "Registry" table in MSI Database:
Registry (s72) Root (i2) Name (L255) Value (L0)
69ADA5050611 1 PATH C:\Program Files\Sample\
Am successfully in deleting the row with the below combination (tired seperatly with every command)
WindowsInstaller.View view = instDb.OpenView("DELETE FROM `Registry` WHERE `Registry`.`Registry`='69ADA5050611'");
WindowsInstaller.View view = instDb.OpenView("DELETE FROM `Registry` WHERE `Registry`.`Name`='PATH'");
WindowsInstaller.View view = instDb.OpenView("DELETE FROM `Registry` WHERE `Registry`.`Value`='C:\Program Files\Sample\'");
But i want to delete the row using "Root" as refernce, am getting error when i use the below command.
WindowsInstaller.View view = instDb.OpenView("DELETE FROM `Registry` WHERE `Registry`.`Root`='1");
I get runtime error for the above line "COMException was unhandled OpenView,Sql"
How to delete the row using Root as reference.
Please suggest.
Cheers,
|
|
|
|
|
Guys, Got the solution, Root column is of i(2).. But am trying to store that as string with quotes '1'
To work, i Should `Registry`.`Root`=1
|
|
|
|
|
Hi I am giving target type as exe and output file name also has extension exe but erro i am getting:
C:\Program Files\Microsoft\ILMerge>ilmerge /target:exe /out:myoutput.exe Utility.exe
FeCom.dll /ndebug /xmldocs /targetplatform:v4
,"%ProgramFiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
An exception occurred during merging:
ILMerge.Merge: /target specified as an executable, but output file, 'C:\Program'
, does not have a .exe extension.
at ILMerging.ILMerge.Merge()
at ILMerging.ILMerge.Main(String[] args)
|
|
|
|
|
It looks like it is mis-reading the "C:\Program Files" path as two separate paths, even though you have it in double quotes. You could try using a relative path to that directory to avoid the two-word path name, something like:
ilmerge /target:exe /out:myoutput.exe Utility.exe FeCom.dll /ndebug /xmldocs /targetplatform:v4 ,..\..\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0
Note: I'm not sure about that comma in front of the last path.
|
|
|
|
|
Thanks Richard MacCutchan,
still I am getting the same errors.
|
|
|
|
|
|
Thanks Richard..
|
|
|
|
|
Perhaps the comma before "%ProgramFiles%... is causing an issue?
|
|
|
|
|
I have researched this for two days and have been unable to find an answer. I'm certain I'm not the only person that wants to display more than one item in the mainform listbox of NAudio so hopefully someone here can tell me what I'm doing wrong. I need to output the results of an array to my listbox. If I use the below code then everything outputs but on a single line, instead of separate ones as I need the user to be able to select the results. I'm assuming that this is because the results are passed over in a single string despite the foreach loop.
mainform.cs
[ImportingConstructor]
public MainForm([ImportMany] IEnumerable<AudioPlugin> content)
{
InitializeComponent();
listBox.DisplayMember = "Name";
foreach (var listing in content)
{
listBox.Items.Add(listing);
}
}
recordingpanel.cs
[Export(typeof(INAudioPlugin))]
public class RecordingPanelPlugin : AudioPlugin
{
private string _customer { get; set; }
public void ConnectionString()
{
using (var conn = new SqlCeConnection("Data Source=MyDatabase.sdf;Password=pass;Persist Security Info=True"))
{
conn.Open();
var comm = new SqlCeCommand("SELECT * FROM main", conn);
SqlCeDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
_customer += (string)(reader["CustomerName"]);
}
}
}
public string Name
{
get
{
ConnectionString();
return _customer;
}
}
public Control CreatePanel()
{
return new RecordingPanel();
}
}
I also tried the above using a struct, List and array with the same results each time. I'm going on the assumption that this INAudioPlugin is changing the data type during ImportingConstructor. So I tried to use the query directly in the mainform.cs. I was able to get the listbox appearing correctly but I cannot get the listbox_SelectedIndexChanged to function propery as that fails at the following line since the listbox contents are string and not INAudioPlugin it looks like. I can't explicitly convert the type either.
var plugin = (INAudioPlugin)listbox.SelectedItem;
I am completely out of ideas at this point, I hope someone can offer me a solution. I have a feeling the second route I tried is going to be where I need to go with this but I can't figure out how to call my recordingpanel.cs if I do so because of the plugin error above. Below is the code I used for the second route I tried.
mainform.cs
[ImportingConstructor]
public MainForm([ImportMany] IEnumerable<INAudioPlugin> content)
{
InitializeComponent();
using (var conn = new SqlCeConnection("Data Source=MyDatabase.sdf;Password=pass;Persist Security Info=True"))
{
conn.Open();
var comm = new SqlCeCommand("SELECT * FROM main", conn);
SqlCeDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
_customer = (string)(reader["CustomerName"]);
listbox.Items.Add(_customer);
}
}
}
private INAudioPlugin currentPlugin;
private void listbox_SelectedIndexChanged(object sender, EventArgs e)
{
var plugin = (INAudioPlugin)listbox.SelectedItem;
if (plugin != currentPlugin)
{
this.currentPlugin = plugin;
DisposeCurrentListing();
var control = plugin.CreatePanel();
control.Dock = DockStyle.Fill;
contentPanel.Controls.Add(control);
}
}
|
|
|
|
|
Caveat: I haven't used NAudio. These suggestions are based on the apparent use of MEF for the plugins. I have not tried any of this. (I am not an MEF guru.)
First: some things that seem clearly wrong.
RecordingPanelPlugin.ConnectionString() (besides having a very misleading name) collects all of the CustomerName column values into a single string. There's nothing keeping them as individual values.
The RecordingPanelPlugin.Name property just returns all of the names concatenated together.
MEF is Importing and creating a single instance of your RecordingPanelPlugin .
You seem to need a "parent" class which creates all of the instances of the RecordingPanelPlugin you want.
Create an interface that MEF can use to instantiate the class that creates the individual instances of RecordingPanelPlugin :
public interface IPluginFactory
{
List<INAudioPlugin> GetAudioPlugins();
}
Simplify the class RecordingPanelPlugin :
[PartNotDiscoverable]
[Export(typeof(INAudioPlugin))]
public class RecordingPanelPlugin : AudioPlugin
{
public RecordingPanelPlugin (string name)
{
this.Name = name;
}
public string Name { get; private set; }
public Control CreatePanel()
{
return new RecordingPanel();
}
}
Then create a class which implements IPluginFactory for the RecordingPanelPlugin :
[Export(typeof(IPluginFactory))]
public class RecordingPanelPluginFactory
{
private public List<INAudioPlugin> AllRecordingPanelPlugins;
public List<INAudioPlugin> GetAudioPlugins()
{
if (AllRecordingPanelPlugins == null)
{
AllRecordingPanelPlugins = new List<INAudioPlugin>();
using (var conn = new SqlCeConnection("Data Source=MyDatabase.sdf;Password=pass;Persist Security Info=True"))
{
conn.Open();
var comm = new SqlCeCommand("SELECT * FROM main", conn);
SqlCeDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
AllRecordingPanelPlugins.Add(new RecordingPanelPlugin((string)(reader["CustomerName"])));
}
}
}
return AllRecordingPanelPlugins;
}
}
Now change the MainForm to have MEF give it all of the IPluginFactory s:
[ImportingConstructor]
public MainForm([ImportMany] IEnumerable<IPluginFactory> factories)
{
InitializeComponent();
listBox.DisplayMember = "Name";
foreach (var factory in factories)
{
foreach (var plugin in factory.GetAudioPlugins())
{
listBox.Items.Add(plugin);
}
}
}
Good luck!
(Remember my caveat above! )
A positive attitude may not solve every problem, but it will annoy enough people to be worth the effort.
|
|
|
|
|
That option didn't work either as the plugin was expecting a different variable type and I wasn't able to implicitly or explicitly convert. So, I decided after almost three days, it was time to rethink my logic. What I decided to do was put my query in my mainform which then displayed the listbox correctly. Then I modified my SelectedIndexChanged event in my mainform so instead of referencing the plugin directly I'm passing the listbox variable to the recordingpanel.cs instead. Everything is working great as expected using my new logic.
Thanks for your response and suggestion though.
|
|
|
|
|
how can I create circular shape button? plz reply
|
|
|
|
|
What technology? WPF? ASP.NET? Windows Forms?
|
|
|
|
|
|
why cant you use an image and click can put click events for that..
more over i think for the circle shaped button we need a lot of discussion about the libraries
|
|
|
|
|
Well, I would normally use the power of WPF to do this. The person who asked the question, however, has no idea that you replied.
|
|
|
|
|
you mean my answer should be elaborated??
|
|
|
|
|
I mean you should give your answer to the person who actually asked the question.
|
|
|
|
|
common friend here we post this to be seen by everyone..
|
|
|
|
|
We do. However, as you are posting against a question that someone has asked, the polite thing to do is to reply to them so that they get notified that there is an answer. By replying to me, I see the notification, but the person who asked the question doesn't.
|
|
|
|
|
OK ok my friend sorry for u and for not replying to him
|
|
|
|
|
Google is your friend; be nice and visit him often...
There are a huge number of examples out there of round buttons, some good, some bad.
A quick google restricted to just this site found nearly 4000 examples: round button c# site:codeproject.com[^]
Try this: Custom Button Control with Gradient Colors and Extra Image (VB.NET)[^] It's VB, but you can just use the code in a DLL.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
how to disable combobox if another combobox is selected in c# windows form application
diviya murali
|
|
|
|