|
i need an example code on delegates and thier functionality
thanx
|
|
|
|
|
Instead of sending more questions to codeproject, you can try to search it in google.
http://www.akadia.com/services/dotnet_delegates_and_events.html
|
|
|
|
|
|
they are the same as function pointer in C++. But in C#, it's much easier to use once you figure out the syntax. Very useful and powerful, if you want to unify your code. there are full of articles on it.
Donkaiser
|
|
|
|
|
is it possible to make a child consistently active? if it is activates, all other children should not be given focus. is this possible? THanks!
|
|
|
|
|
hi,
how can i stream the sound live from the microphone with directx.net???
directx has a capture sound (managed) sample...but the problem here is:
public CaptureBuffer applicationBuffer = null;
applicationBuffer.Stop();
CaptureData = (byte[])applicationBuffer.Read(NextCaptureOffset, typeof(byte), LockFlag.None, LockSize);
...the buffer only could read if the applicationBuffer.Stop() is called...thats not fine for a live stream....
any other idea? will i need a any graphBuilder??? how does it work?
best regards, surf
|
|
|
|
|
I have a project that uses a COM DLL. .NET created an interop assembly for me. I want to embed the DLL and the interop (Type Library ?) within my application so as to have a single file execution(the executable). Is this possible?
I have tried adding the files as embedded resources, but still get a file not found exception when I run the application.
Thanks
www.lovethosetrains.com
|
|
|
|
|
Hi!
You can't embed other assemblies in your executable as resources and expect the framework to find them.
Resources are for images, strings and so on, not for compiled code!
There is a tool, though, that can wrap all assemblies your application needs into a single executable: http://research.microsoft.com/~mbarnett/ILMerge.aspx
But if you access COM objects, these cannot be merged into your application at all, only the interop assembly.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Thanks for the suggestion...
Once I sober up and feel like working on real work again I'll give it a try.. I downloaded ILMerge at work, and breifly thought about working with it at home and then realized I don't get paid for it.
I'm sure the best will get later this weekend... once again thanks.. reads like what I am looking for.
www.lovethosetrains.com
|
|
|
|
|
Hey all,
I'm writing an application where a FileSystemWatcher is monitoring for the addition of new files in a specific directory. When new files are detected the handler for the FileSystemWatcher.Created event captures information about the file and stores it in another object. What I need to do at this stage is start a Timer, when the first file is detected, for 5 seconds. If another file is detected before the Timer expires then the Timer should gain another 5 seconds. This should continue until the FileSystemWatcher hasn't detected a new file for five seconds, at which time the batch of captured data is moved to another stage of processing.
I think a Timer would be the best way to handle this need but I'm not sure. Do you guys think I'm on the right track or can you think of a better way to handle this kind of batched capture-and-release? I've been working on it for couple of days now and am totally confused. Any advice would be greatly appreciated.
Thanks.
-- DDennison
|
|
|
|
|
I am wanting to add a blank line to a datagrid so the user can enter new info. I found an example online (Newbie here!) that shows how to do it, but it only uses one table:
protected void dg_bind() {<br />
<br />
System.Data.SqlClient.SqlConnection SqlCon = new System.Data.SqlClient.SqlConnection( "server=localhost;database=northwind;trusted_connection=true;" );<br />
System.Data.SqlClient.SqlDataAdapter SqlDa = new System.Data.SqlClient.SqlDataAdapter( "SELECT TOP 10 ProductName FROM Products", SqlCon );<br />
ds = new System.Data.DataSet( );<br />
SqlDa.Fill( ds, "Products" );<br />
System.Data.DataRow BlankRow = ds.Tables[ "Products" ].NewRow( );<br />
BlankRow[ "ProductName" ] = "<font color=\"red\">add new product</font>";<br />
ds.Tables[ "Products" ].Rows.InsertAt( BlankRow, 0 );<br />
dg.DataSource = ds.Tables[ "Products" ];<br />
}
Currently my own BindData function looks like this:
private void BindData()<br />
{<br />
strPartNumberInputReference = txtPartNumberInput.Text;<br />
string SQLString = "SELECT c.cost, pt.description, dd.DrawingNumber, dd.DrawingRevision, dd.DwgPath FROM costs c INNER JOIN Parts p ON c.PartID = p.Id INNER JOIN PartTypes pt on pt.ID = p.PartTypeID LEFT JOIN DraftingData dd on dd.PartID = p.ID WHERE p.PartNumber = @PartID";<br />
SqlCommand cmd = new SqlCommand();<br />
cmd.Connection = new SqlConnection(strConnectSQL);<br />
cmd.CommandText = SQLString;<br />
cmd.Parameters.Add ("@PartID", strPartNumberInputReference);<br />
SqlDataAdapter adapter = new SqlDataAdapter(cmd);<br />
DataSet ds = new DataSet();<br />
adapter.Fill(ds);<br />
dgParts.DataSource = ds;<br />
dgParts.DataBind();<br />
}
How do I convert that first code that I bolded to work with my program and multiple tables?
|
|
|
|
|
Hi i have a tab control with several tab. I want to each time when i enter a tab the font become bold. i couldn't find a property for that. I know i can handle it at the enter event but don't know how.
Any suggestion?
Donkaiser
|
|
|
|
|
I did something like that once. It went a little somethin' like this...
private Font boldFont;
private void tabControl1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{
if( this.boldFont == null )
this.boldFont = new Font( this.tabControl1.Font, FontStyle.Bold );
TabPage page = this.tabControl1.TabPages[e.Index];
bool selected = page == this.tabControl1.SelectedTab;
StringFormat frmt = new StringFormat();
frmt.LineAlignment = StringAlignment.Center;
using( Brush brush = new SolidBrush( page.BackColor ) )
e.Graphics.FillRectangle( brush, e.Bounds );
e.Graphics.DrawString( page.Text, selected ? this.boldFont : this.tabControl1.Font, SystemBrushes.ControlText, e.Bounds, frmt );
}
HAPPY WEEKEND!!!
Josh
|
|
|
|
|
I pasted ur code and the event is not firing up. i even got to property and doubleclick on drawItem.
Donkaiser
|
|
|
|
|
Oops, forgot to mention that you need to set the TabControl's DrawMode to the non-default value (OwnerFixed?).
Josh
|
|
|
|
|
Thanks a lot for your help. It's ridiculous that to change the font of the title is so complicated.
your code is working but when a tabpage is not selected the font is not appearing fully on the tab title. I'm planning to resize the page title, is there a way to do that?
Donkaiser
|
|
|
|
|
the option appears on the tabcontrol in item size. don't forget to set size mode to fixed.
Donkaiser
|
|
|
|
|
Hi
am new to windows service.what ever samples i see ,it is described that by default the servicebase class will be available, after that the installer needs to be added .
It makes sense that the installers are needed to install the service to the OS as a service . But i don't find any code relations that the service class refers the installer classes .
Please xplain me
1. where is the link between the service class & the installer
2. how the installer identifies which service needs to be installed(service seems accepts any text string not hardly the service class)
Thanks & Regards
Raghuraman.C
|
|
|
|
|
Hello,
Can anyone tell me how I can locate a program that is minimized to the system tray. I know the Process Id of the application, but when I call Interaction.AppActivate using the process Id I get an ArgumentException exception. However, I don't know the title of the application to use the (Win32)FindWindow method.
Apparently programs that run in the system Tray can not be retrieved using this method. I am able to retrieve all other types of programs using this method.
Here is my code that locates the application and activates it to bring it to the front.
private void onLocateApplicationButtonClick(object sender, EventArgs e)<br />
{<br />
if ((null != sender)<br />
&& (sender is Control)<br />
&& (null != ((Control)sender).Tag)<br />
&& (((Control)sender).Tag is int))<br />
{<br />
int app_index = (int)((Control)sender).Tag;<br />
<br />
try<br />
{<br />
Interaction.AppActivate(m_processes_list[app_index].Id);<br />
}<br />
catch (ArgumentException aex)<br />
{<br />
Console.WriteLine("{0}", aex.Message);<br />
}<br />
}<br />
}
Any one have a suggestion?
Thanks,
DP
|
|
|
|
|
Maybe this will give you a head start, ignore the custom types referenced that aren't included in this code. If you have the process id, you should be able to identify it while looping through all processes. You'll probably need to use the CaptureWindowless() example.
using System;
using System.Diagnostics;
using System.ComponentModel;
using System.Runtime.InteropServices;
using BoneSoft.LinksLibrary;
namespace LinksLibrarian2 {
public class ProcessCapturer {
static ProcessCapturer() {}
public static ShortCuts CaptureWindows() {
ShortCuts scs = new ShortCuts();
scs.AddRange(CaptureFolders());
scs.AddRange(CaptureIEs());
Process[] localAll = Process.GetProcesses();
foreach (Process p in localAll) {
try {
if (p.MainWindowTitle.Equals(string.Empty)) { continue; }
ShortCut esc = null;
esc = new ExeShortCut(p.MainWindowTitle, p.MainModule.FileName);
if (esc == null) { continue; }
esc.Description = p.ProcessName;
scs.Add(esc);
} catch {}
}
return scs;
}
public static ShortCuts CaptureWindowless() {
ShortCuts scs = new ShortCuts();
Process[] localAll = Process.GetProcesses();
foreach (Process p in localAll) {
try {
if (!p.MainWindowTitle.Equals(string.Empty)) { continue; }
ShortCut esc = null;
esc = new ExeShortCut(p.ProcessName, p.MainModule.FileName);
if (esc == null) { continue; }
esc.Description = p.ProcessName;
scs.Add(esc);
} catch {}
}
return scs;
}
}
}
Visit BoneSoft.com
|
|
|
|
|
Thanks for your help.
I used your 'CaptureWindowless' example to verify that the Process Id I have is in the list of all Processes and it is. However, I am still unable to Activate that given process so that it brings my application to the front.
Using your code I added the following try-catch once I verify the Process is in the list. And I pass the process name to the (Win32) method, FindWindow, and it returns zero - could not find it.
try
{
Interaction.AppActivate(id);
}
catch (ArgumentException)
{
uint hwndInstance = FindWindow(null, p.ProcessName);
}
|
|
|
|
|
Hey Everyone,
This is my 2nd day using C# and so far it's been pretty cool. I'm trying to write an application that will return system information to me such as the processor type and RAM speed of a system. Any idea how I would go about that?
Thank you in advance.
-Karthik Gaekwad
|
|
|
|
|
|
That is perfect! Thanks a million.
-K
|
|
|
|
|
I have a typed dataset with an integer value called FiscalMonth. What I want to do is bind it to a combobox that is preseeded with a list of integers from 1-12.
Here's what I have so far:
<br />
for (int i = 1; i <= 12; i++)<br />
{<br />
uxcbFMonth.Items.Add(i);<br />
}<br />
<br />
mySource = new BindingSource();<br />
<br />
mySource.DataSource = myManagerClient.VersionTable.Select("VersionKey = " +VersionKey.ToString())[0];
That seems to work just fine, the combobox is populated, and in the text fields, the databinding (using Control.DataBindings.Add) works. The problem is it doesn't appear as if the combobox databinding works, because when I try to change it the control locks and remains selected until I manually close the application.
I assign the databindings like this:
uxcbFMonth.DataBindings.Add("SelectedValue", mySource, "FiscalMonth", true, DataSourceUpdateMode.OnValidation);
Am I binding to the wrong value? Any ideas?
|
|
|
|