|
Hi
I'me working on a tapi project with tapi3.dll. I successfully created calls with ITAddress etc. Now I tried to call the method TranslateAddress from the class ITAddressTranslation, which is an abstract class. Unfortunately without success.
Now the question: Does anybody know how I can use this method? How do I have to instantiate the class ITAddressTranslation in order to get this method?
Thanks Fredy
|
|
|
|
|
hi,can anyone tell me a way of voice chat in c#,i will be very thankful to u.
|
|
|
|
|
Hi,
I want to filter the rows of the DataTable using the DataTables's Select() method.
I have a DataTime column in the DataTable. My Search Criteria should check that
DateTime Column's Hour value with the present System Time's Hour value
and
DateTime Column's Minute value with the present System Time's Minute value.
What functions/methods can i specify to extract the Hour, Minute from the DateTime column of the DataTable?
The following is the code:
string lstr = string.Empty;
lstr = "datename(hh,getdate())= datename(hh,schedule_time) and datename(mi,getdate())= datename(mi,schedule_time)";
DataRow[] dr = mds.Tables[0].Select(lstr);
Thanks in advance.
-- modified at 6:50 Friday 16th September, 2005
|
|
|
|
|
hey all,
am getting image using SHGetFileInfo for form Image, but when i put it onto a toolbarbutton i get black where it should be transparent.
i tried to convert to bitmap before putting icon into the imagelist but still no good.
any ideas pls?
<br />
private void CreateNewMDIChild(string path)<br />
{<br />
EditorPane pane = new EditorPane(path);<br />
pane.MdiParent = this;<br />
pane.Show();<br />
<br />
this.documentImageList.Images.Add(pane.Icon);<br />
<br />
ToolBarButton button = new ToolBarButton(pane.FileName);<br />
button.ToolTipText = pane.Path; <br />
button.ImageIndex = MdiChildren.Length - 1;<br />
this.mdiChildrenToolbar.Buttons.Add(button);<br />
<br />
UpdateButtonPushState(button);<br />
}<br />
kind regards,
g00fy
|
|
|
|
|
Hi,
Check for the size of the Image/Icon and the Image Size selected for the ImageList control. Both the size should match inorder to display the icon properly
Best Regards,
|
|
|
|
|
yes they are same => 16, 16, transparentColor = transparent, ColorDepth => Depth8Bit
one thing i have noticed debugging is that the depth of the icon of the form, is 0 which is not same as imagelist.
regards,
g00fy
|
|
|
|
|
Hi!
Could be the rather well-known "32bpp images in an ImageList lose transparency" bug.
You'll find a lot of stuff/suggestions/discussions when you google for "imagelist transparency bug".
Regards,
mav
|
|
|
|
|
Hi
I'm trying to start a timer event from another event. A event is activated from an external button through the parallellport.
This works perfect. I can fire almost anything, but not the timer. I want to start a countdown when i press the external button. The timer starts if I start it from a formbutton.
Please help.
//Nicklas
Here is part of my code:
public delegate void PortDataHandler(object sender, MyDataEventArgs e);
private System.Threading.ThreadStart threadStart;
private System.Threading.Thread thread;
public event PortDataHandler OnPortDataChange;
Timer timer1 = new Timer();
private void Form1_Load(object sender, System.EventArgs e)
{
drive();
}
private void drive()
{
//my timer
timer1.Tick += new EventHandler(Ticker);
timer1.Interval = 1000;
//my event
OnPortDataChange += new PortDataHandler(my_Handler);
this.threadStart = new System.Threading.
ThreadStart(Application_Tick);
this.thread = new System.Threading.Thread(threadStart);
this.thread.Start();
}
public class MyDataEventArgs : EventArgs
{
public readonly int TheNumber;
public MyDataEventArgs(int num)
{
TheNumber = num;
}
}
public void Application_Tick()
{
while ((Input(889)==120))
{
}
OnPortDataChange(this, new MyDataEventArgs(Input(889)));
drive();
}
void Ticker(object sender, EventArgs e)
{
//do something every second
}
public void my_counter()
{
label1.Text="now you are here";
timer1.Start(); //the timer don't start from here
}
public void my_Handler(object sender, MyDataEventArgs e)
{
this.label2.Text="You pressed the button!!";
my_counter();
//PlaySound( "C:/mina mappar/project programming/play2/sound.wav", 0, 1 );
//timer1.start(); //timer dont start here
private void button1_Click(object sender, System.EventArgs e)
{
//label1.Text="vanliga knappen";
this.thread.Abort();
this.Close();
//OnPortDataChange(this, new MyDataEventArgs(Input(889)));
}
private void button2_Click(object sender, System.EventArgs e)
{
timer1.Start(); //the timer start here????????? but not where i want.
}
}
}
|
|
|
|
|
Hi!
It might have to do with the type of timer you use.
You just wrote Timer , but from the Tick event I guess it's the System.Windows.Forms.Timer class.
This kind of timer depends on your UI thread's message pump to work, so this could be the problem (depends on the rest of your program).
Try using System.Timers.Timer instead.
Regards,
mav
|
|
|
|
|
Can anyone explain me more about CLR ??
|
|
|
|
|
|
Hi, I am looking for a way to merge video file together on-the-fly, I have find some demo activeX control doing it, but it's always by recompressing the whole video, so it take ages. I'd like to do it the way most shareware (like "Easy Video Joiner") do it, without decompressing the frame.
Any help or info could help me.
Thansk you a lot in advance.
|
|
|
|
|
How do I use the less than sign in documentation
e.g. I want
/// <returns>0 (equal), 1 (s1>s2), -1 (s1 < s2)
but VS.Net thinks the < sign is opening another documentation tag. Is there some way to escape the character so that it doesn't do this?
|
|
|
|
|
< = & lt ; > = & gt ;
no spaces from & to ; just did this so cp wouldnt see it as < = <
hth
goofy
|
|
|
|
|
Thanks although initially I thought I had to include the < and = parts as well so this was confusing. So the actual replacement for
less than (<) is
& lt ;
without the space.
thanks again
Claire
|
|
|
|
|
yes that is it,
anytime
regards,
g00fy
|
|
|
|
|
Below i have posted the code for my little project, my problem is located at the line looking like this
"tempArray[iCounter++] = btnArray[iButtonIndex];"
and i'm getting this error:
Property or indexer 'ButtonArray.ButtonArray.this[int]' cannot be assigned to -- it is read only
What i'm trying to do is this, once i have removed an object from btnArray, i want to copy the remaining stuff of btnArray to tempArray in order to re-arrange the elements. This should be done through the CopyArray().
However i can't figure out why im getting a readonly error, can anyone please help me out?
Thanks alot in advance!
-----------------------------------------------------------------
CODE FOR FORM1.CS BELOW
-----------------------------------------------------------------
using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
using System.Data;<br />
using ButtonArray;<br />
<br />
namespace ButtonArray<br />
{<br />
public class Form1 : System.Windows.Forms.Form<br />
{<br />
private System.Windows.Forms.Button btnAdd;<br />
private System.Windows.Forms.Button btnRemove;<br />
private System.Windows.Forms.Button btnRemoveX;<br />
private System.Windows.Forms.TextBox txtRemoveX;<br />
<br />
public int iRemoveX;<br />
<br />
ButtonArray btnArray;<br />
ButtonArray tempArray;<br />
<br />
private System.ComponentModel.Container components = null;<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
<br />
}<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
if( disposing )<br />
{<br />
if (components != null) <br />
{<br />
components.Dispose();<br />
}<br />
}<br />
base.Dispose( disposing );<br />
}<br />
<br />
#region Windows Form Designer generated code<br />
private void InitializeComponent()<br />
{<br />
this.btnAdd = new System.Windows.Forms.Button();<br />
this.btnRemove = new System.Windows.Forms.Button();<br />
this.btnRemoveX = new System.Windows.Forms.Button();<br />
this.txtRemoveX = new System.Windows.Forms.TextBox();<br />
this.SuspendLayout();<br />
this.btnAdd.Location = new System.Drawing.Point(192, 8);<br />
this.btnAdd.Name = "btnAdd";<br />
this.btnAdd.Size = new System.Drawing.Size(96, 23);<br />
this.btnAdd.TabIndex = 0;<br />
this.btnAdd.Text = "Add Button";<br />
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);<br />
this.btnRemove.Location = new System.Drawing.Point(192, 40);<br />
this.btnRemove.Name = "btnRemove";<br />
this.btnRemove.Size = new System.Drawing.Size(96, 23);<br />
this.btnRemove.TabIndex = 1;<br />
this.btnRemove.Text = "Remove Button";<br />
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);<br />
this.btnRemoveX.Location = new System.Drawing.Point(192, 104);<br />
this.btnRemoveX.Name = "btnRemoveX";<br />
this.btnRemoveX.Size = new System.Drawing.Size(96, 23);<br />
this.btnRemoveX.TabIndex = 2;<br />
this.btnRemoveX.Text = "Remove X";<br />
this.btnRemoveX.Click += new System.EventHandler(this.btnRemoveX_Click);<br />
this.txtRemoveX.Location = new System.Drawing.Point(192, 136);<br />
this.txtRemoveX.Name = "txtRemoveX";<br />
this.txtRemoveX.Size = new System.Drawing.Size(96, 20);<br />
this.txtRemoveX.TabIndex = 3;<br />
this.txtRemoveX.Text = "";<br />
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<br />
this.ClientSize = new System.Drawing.Size(292, 266);<br />
this.Controls.Add(this.txtRemoveX);<br />
this.Controls.Add(this.btnRemoveX);<br />
this.Controls.Add(this.btnRemove);<br />
this.Controls.Add(this.btnAdd);<br />
this.Name = "Form1";<br />
this.Text = "Form1";<br />
this.Load += new System.EventHandler(this.Form1_Load);<br />
this.ResumeLayout(false);<br />
<br />
btnArray = new ButtonArray(this);<br />
tempArray = new ButtonArray(this);<br />
<br />
}<br />
#endregion<br />
<br />
[STAThread]<br />
static void Main() <br />
{<br />
Application.Run(new Form1());<br />
}<br />
<br />
private void Form1_Load(object sender, System.EventArgs e)<br />
{<br />
<br />
}<br />
<br />
private void aButton_Click(object sender, System.EventArgs e)<br />
{<br />
<br />
}<br />
<br />
private void btnAdd_Click(object sender, System.EventArgs e)<br />
{<br />
btnArray.AddNewButton();<br />
btnArray[0].BackColor = System.Drawing.Color.Red;<br />
}<br />
<br />
private void btnRemove_Click(object sender, System.EventArgs e)<br />
{<br />
<br />
if(btnArray.Count > 0)<br />
{<br />
btnArray.Remove(btnArray.Count-1);<br />
}<br />
else <br />
{<br />
MessageBox.Show("ARRAY IS EMPTY");<br />
}
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
private void btnRemoveX_Click(object sender, System.EventArgs e)<br />
{<br />
try<br />
{ <br />
iRemoveX = Convert.ToInt32(txtRemoveX.Text);<br />
<br />
if(btnArray.Count > 0)<br />
{<br />
btnArray.Remove(iRemoveX);<br />
}<br />
else <br />
{<br />
MessageBox.Show("(REMOVE) ARRAY IS EMPTY");<br />
}<br />
}<br />
<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show("ERROR: " + ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error,MessageBoxDefaultButton.Button1); <br />
}<br />
}<br />
<br />
private void CopyArray()<br />
{<br />
try<br />
{<br />
if(btnArray.Count > 0)<br />
{<br />
int iCounter;<br />
for (int iButtonIndex = 0; iButtonIndex < btnArray.Count; iButtonIndex++)<br />
{<br />
if (btnArray[iButtonIndex] != null)<br />
{<br />
tempArray[iCounter++] = btnArray[iButtonIndex];<br />
iCounter++;<br />
}<br />
}<br />
}<br />
else<br />
{<br />
MessageBox.Show("(COPY) ARRAY IS EMPTY");<br />
}<br />
<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show("ERROR: " + ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error,MessageBoxDefaultButton.Button1);<br />
}<br />
}<br />
<br />
private void ShowArray()<br />
{<br />
}<br />
}<br />
}
----------------------------------------------------------------
CODE FOR BUTTONARRAY.CS BELOW
----------------------------------------------------------------
using System;<br />
<br />
namespace ButtonArray<br />
{<br />
public class ButtonArray : System.Collections.CollectionBase<br />
{<br />
private readonly System.Windows.Forms.Form HostForm;<br />
<br />
public System.Windows.Forms.Button AddNewButton()<br />
{<br />
System.Windows.Forms.Button aButton = new System.Windows.Forms.Button();<br />
<br />
this.List.Add(aButton);<br />
<br />
HostForm.Controls.Add(aButton);<br />
<br />
aButton.Top = Count * 25;<br />
aButton.Left = 100;<br />
aButton.Tag = this.Count;<br />
aButton.Text = "Button " + this.Count.ToString();<br />
<br />
<br />
aButton.Click += new System.EventHandler(ClickHandler);<br />
<br />
return aButton;<br />
}<br />
public ButtonArray(System.Windows.Forms.Form host)<br />
{<br />
HostForm = host;<br />
this.AddNewButton();<br />
}<br />
<br />
public System.Windows.Forms.Button this [int Index]<br />
{<br />
get<br />
{<br />
return (System.Windows.Forms.Button) this.List[Index];<br />
}<br />
}<br />
<br />
public void Remove(int iRemoveX)<br />
{<br />
if (this.Count > 0)<br />
{<br />
<br />
HostForm.Controls.Remove(this[iRemoveX]);<br />
this.List.RemoveAt(this.Count -1);<br />
}<br />
}<br />
<br />
public void ClickHandler(Object sender, System.EventArgs e)<br />
{<br />
System.Windows.Forms.MessageBox.Show("You have clicked button " + <br />
((System.Windows.Forms.Button) sender).Tag.ToString());<br />
}<br />
}<br />
}
|
|
|
|
|
Please only post the code that is relevant for the question.
---
b { font-weight: normal; }
|
|
|
|
|
// Declare a new ButtonArray object.
ButtonArray btnArray;
ButtonArray tempArray;
btnArray = new ButtonArray(this);
tempArray = new ButtonArray(this);
private void CopyArray()
{
try
{
if(btnArray.Count > 0)
{
int iCounter;
for (int iButtonIndex = 0; iButtonIndex < btnArray.Count; iButtonIndex++)
{
if (btnArray[iButtonIndex] != null)
{
tempArray[iCounter++] = btnArray[iButtonIndex];
iCounter++;
}
}
}
else
{
MessageBox.Show("(COPY) ARRAY IS EMPTY");
}
}
catch(Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error,MessageBoxDefaultButton.Button1);
}
}
----------------------------------------------------------------
CODE FOR BUTTONARRAY.CS BELOW
----------------------------------------------------------------
using System;
namespace ButtonArray
{
public class ButtonArray : System.Collections.CollectionBase
{
private readonly System.Windows.Forms.Form HostForm;
public System.Windows.Forms.Button AddNewButton()
{
// Create a new instance of the Button class.
System.Windows.Forms.Button aButton = new System.Windows.Forms.Button();
// Add the button to the collection's internal list.
this.List.Add(aButton);
// Add the button to the controls collection of the form
// referenced by the HostForm field.
HostForm.Controls.Add(aButton);
// Set intial properties for the button object.
aButton.Top = Count * 25;
aButton.Left = 100;
aButton.Tag = this.Count;
aButton.Text = "Button " + this.Count.ToString();
aButton.Click += new System.EventHandler(ClickHandler);
return aButton;
}
public ButtonArray(System.Windows.Forms.Form host)
{
HostForm = host;
this.AddNewButton();
}
public System.Windows.Forms.Button this [int Index]
{
get
{
return (System.Windows.Forms.Button) this.List[Index];
}
}
public void Remove(int iRemoveX)
{
// Check to be sure there is a button to remove.
if (this.Count > 0)
{
// Remove the last button added to the array from the host form
// controls collection. Note the use of the indexer in accessing
// the array.
// Remove the button indexed with the value of iRemoveX
HostForm.Controls.Remove(this[iRemoveX]);
this.List.RemoveAt(this.Count -1);
}
}
public void ClickHandler(Object sender, System.EventArgs e)
{
System.Windows.Forms.MessageBox.Show("You have clicked button " +
((System.Windows.Forms.Button) sender).Tag.ToString());
}
}
}
|
|
|
|
|
You have no set method (only get method) on the default indexer (this[]) property.
---
b { font-weight: normal; }
|
|
|
|
|
I see.. would you happen to have a suggestion on how to make this set method?
Thanks alot for the help so far
|
|
|
|
|
It's just the reverse of the get method.
set<br />
{<br />
this.List[Index] = value;<br />
}
---
b { font-weight: normal; }
|
|
|
|
|
Thanks alot for the help!
|
|
|
|
|
In the Style definitions for a DataGrid I defined a DataGridBoolColumn to show Boxes for
the true/false-values in the DataView of the Grid.
To set/toggle Buttons I have to check out, if the Box in a [Row,Column] is set to Enable or Disable by the click-event / space-key (if cell selected).
I have included an eventhandler (DataChanged) for the DataTable which is bound to the Grid.
But only if the SelectedCell is changed, the event for DataChanged will be fired. So, how can I receive an event for the changed Value in the Box if the user do not change the Cell (only 1 Click in the Box to mark it) and won't leave the DataGrid (events validating/valdated therefore will not be fired) ?
Any Idea ?
- If Data is changed, you can see the shown pencil at the row-marker-column. May I fetch this event inside the Grid in any way? May this be a workaround?
|
|
|
|
|
I create a UserControl and add a TextBox into the control.I want to have a Text property,in order that set or get the TextBox.Text.But I know Control class had the same property,and then I key the code that in list
--------------------
public partial class UserControl1 : UserControl
{
string _t;
[Browsable(true)]
public override string Text
{
get
{
this.textBox1.Text = _t;
return _t;
}
set
{
_t = value;
this.textBox1.Text = _t;
}
...
}
-----------------------------
When I test the control,I modify the Text property in the Properties Designer of the VS.NET 2005,The Control.Text get a value.But I open the method InitializeComponent() ,I can not find the code that initialize control.Text.
So,When the test application running,The value that Text property of the TextBox in the control is lost.
Can you tell me why? How to deal with it? Thanks a lot!
|
|
|
|
|