|
Hi Martin,
Lost focus can happen even when the user select someother control via mouse. I need to implement TAB navigation. I cannot do this using Lost Control event.
Let me know if there is any other alternative.
Regards,
Kais
|
|
|
|
|
how to hide one column of gridlayout
how to check grid changed
sikandar
|
|
|
|
|
Hello
What is a GridLayout?? Maybe you Mean DataGridView, or Datagrid?
Regards
|
|
|
|
|
Hi,
I associate a multi-level contextMenu to a control by using contextMenuStrip. I associates right-click events
for each toolStripMenuItem, so there are many events registered
and it seems quite rather inefficiency. Are there any methods
similiar to the Toolbar that only one single click event is needed
for all buttons in the toolbar ?
Thanks
|
|
|
|
|
Hello everyone,
I have a regex object with "([A-Za-z0-9ığçöşüİĞÇÖŞÜ]{1})([A-Za-z0-9\sığçöşüİĞÇÖŞÜ])*$".. The pattern I want to implement is beginning with a letter/digit and continue with letter/digit/whitespace
But this pattern matches with something like 'a
Why is that and what can I do to correct my pattern..
Best regards!
PS: is there a way to make the input NOT contain two or more consecutive whitespaces ?
.:: Something is Wrong ::.
|
|
|
|
|
You have forgotten the ^ to match the beginning of the text.
---
b { font-weight: normal; }
|
|
|
|
|
Hi
I am displaying the available COM ports in a combo box. But the system gives me the available port names in some order. i wish to arrange it in ascending order. I tried the following
<br />
string[] strPort = SerialPort.GetPortNames();<br />
<br />
Array.Sort(strPort);<br />
listBoxUpDownPort.Items.AddRange(strPort);<br />
But this do.. like this.
COM1
COM10
COM11
COM12
..
COM20
COM21
But i wanted to be like this
COM1
COM2
..
COM10
COM11
..
COM20
COM21
Thanks
Srini
|
|
|
|
|
hi if u findout the result.....
plzzzzzzzzzzz let me know it... i am facing the similar problem here.......
if i did it first will let u know.........
|
|
|
|
|
How about write a funtion to sort it :
static void Sort(string[] ports)
{
int[] portsNumber = new int[ports.Length];
for (int i = 0; i < ports.Length; i++)
portsNumber[i] = int.Parse(ports[i].Replace("COM", ""));
Array.Sort(portsNumber);
for (int i = 0; i < ports.Length; i++)
ports[i] = "COM" + portsNumber[i].ToString();
}
|
|
|
|
|
Hi thanks for ur reply,
I also tried to sort like this
<br />
string[] strPort=new string[] {"COM1","COM20","COM21","COM11","COM17","COM18","COM19","COM7"};<br />
string strTemp = "";<br />
for(int i=0;i<strPort.Length;i++)<br />
for (int j = 0; j < i; j++)<br />
{<br />
if (Convert.ToInt32(strPort[i].Substring(3)) < Convert.ToInt32(strPort[j].Substring(3)))<br />
{<br />
strTemp = strPort[j];<br />
strPort[j] = strPort[i];<br />
strPort[i] = strTemp;<br />
}<br />
}<br />
|
|
|
|
|
If i have a class "ClassA" having instance of a unmanaged object in it. and when i created the instance of ClassA. if exception comes then how the unmanaged object release the memory as CLR just release the memory of the managed code/managed object
Rickey
|
|
|
|
|
You'll have to encapsulate all the code where an exception can occur in a try/catch and release the memory in the catch case.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
You really should write an internal wrapper class that encapsulates the unmanaged resource. This class should have the responsibility for acquiring and releasing the resource properly and safely.
If you are using .NET 2.0, have a look at the SafeHandle[^] class, which may save you a lot of work and hassle.
Also, you need to make sure you implement IDisposable[^] on your wrapper (or the main class if you don't use the wrapper method). Check out http://www.codeproject.com/useritems/idisposable.asp[^] for more details on implementing the Dispose pattern.
|
|
|
|
|
ok i am using .Net 1.1, Suppose i have not used any exception handler and also not implemented the idisposable interface then how the memory will manage.Will this be the memory leakage or unmanage object managed by CLR(if any possible way is there)?
Rickey
|
|
|
|
|
public void Append(bool IsRemote, string name, string message)
{
try
{
// listBox1.Font = new Font("Arial", 10, FontStyle.Bold);
listView3.Font = new Font("Arial",10,FontStyle.Bold);
listView3.ForeColor = Color.Blue;
// listBox1.ForeColor = Color.Red;
}
else
{
listView3.ForeColor = Color.Blue;
//listBox1.ForeColor = Color.Blue;
}
listView3.Items.Add(name + " : " +message);
//listBox1.Items.Add(name + " :" + message);
}
In windows mobile application, how to append the text in listbox or listview?
I tried listbox and listview but both exception coming:
NotSupportedException coming
which one i want to use? Anybody help me
|
|
|
|
|
You could use somthing like this.
ListItem item = new ListItem(message,name);
listBox1.Items.Add(item);
|
|
|
|
|
Thanks,
I tried the code, but listBox1.Items.Add(item) here NotSupportedException coming.
I am testing pocketpc 5.0 emulator using visualstudio2005.
That one listbox/listview can supported or not?.
listbox.selecteditem also not coming.
please help me,
Thanks&Regards
|
|
|
|
|
Hi all,
I am a newbie in C#. Can you suggest me one or two books to start learning C#? I have fair knowledge of C++ and MFC. Also please suggest me some good articles which explains the basics of C# and teaches how to do simple tasks with C#. Thank you very much for your time.
|
|
|
|
|
Just take a look through the beginner articles here. The best way to learn would be to think of a simple application you want to write, start writing it using Google etc to help you. If you become really stuck then post a question here.
I find you always learn more by hands-on-experience
As of how to accomplish this, have you ever tried Google?
|
|
|
|
|
Hi,
I have a datagrid that is binded to a datatable (in form of a dataview). I have a requirement that when a particular column in the grid has a value (say 'stat'), then the entire row should be painted in red(the text should be red) else black.
I have extended DatagridColumnStyles for my custom columns. In the paint method, i check for the value in the dataview and accordingly set the forebrush.However, when the user sorts the grid, although it shows the dataview to be sorted, still, the value retrieved is incorrect. I use the row parameter of paint to get the value from the dataview.
Here is the sample code
protected override void Paint(Graphics g, Rectangle rect, CurrencyManager cm, int row, Brush backBrush, Brush foreBrush, bool rightAlign)
{
bool isStatRow = false;
DataRowView rView = null;
try
{
DataView dview = DataGridTableStyle.DataGrid.DataSource as DataView;
if( dview != null )
{
string strStat = dview.Table.Rows[row]["ORD_SCHEDULE_INTERVAL"] as string;
if( strStat != null )
{
string val = strStat.Trim().ToLower();
if( val.IndexOf("stat") == -1 )
isStatRow = false;
else
isStatRow=true;
}
}
}
catch(Exception ex)
{
}
g.FillRectangle(backBrush, rect);
string str = HelperClass.GetString(GetColumnValueAtRow(cm, row), NullText);
if( isStatRow )
{
g.DrawString(str, DataGridTableStyle.DataGrid.Font, new SolidBrush(Color.Red), rect);
}
else
{
g.DrawString(str, DataGridTableStyle.DataGrid.Font, foreBrush, rect);
}
}
The code works when the grid is first painted, but once the same is sorted, this returns me errorneous values and thus paints the color wrongly. I tried using currencymanager.Current also but to no use.
Any ideas???
Please respond
Ashish Sood
|
|
|
|
|
Hello,
I have the SID of a user and the SID of a group. Now I need to check if the user is member of that group... So I think I should get the members and there SID of a group and then check with a for-loop if the SID is present. Is there anyone that knows how I could do that?
|
|
|
|
|
private void btnRemove_Click(object sender, EventArgs e)
{
ListViewItem item = listView1.SelectedItems[0];
if (item != null)
{
string fileid = item.Tag.ToString();
mcaller.removeShare(fileid);
}
btnRemove.Enabled = false;
}
that one i tried in windows application. successfull
But, now i am doing windows mobile application, the listview.SelectedItems
option not in.Any alternate option??
please give me the solution.
In windows mobile how to create columns in listview?
Anybody help me...
|
|
|
|
|
Hello
Sri harini wrote: Any alternate option??
Yes! Use SelectedIndices instead.
Sri harini wrote: In windows mobile how to create columns in listview?
Same as you would in PC:
MyListView.Columns.Add("MyNewColumn");
NB.
There is an icon in MSDN at the left of each member of a class in the "all members" page, indecating that it's available in .Net compact framework or not. It resembles a PDA. Use those only.
Regards
|
|
|
|
|
Hi, Thanks for your reply.
I tried that one.
ListViewItem item = listView1.SelectedIndices[0];
But error coming:
Cannot implicitly convert type 'string' to 'System.Windows.Forms.ListViewItem'
please help me...
Bi
|
|
|
|
|
Hello
Sure you can't do that. SelectedIndices is a collection of integers. You use them this way:
ListViewItem MyItem;
foreach(int X in MylistView.SelectedIndices)
{
MyItem = MyListView.Items[X];
}
Or more simply if you want to access a certain item -provided that you are sure that there are atleast one selected item-:
ListViewItem MyItem = MyListView.Items[MyListView.SelectedIndices[0]];
If there are no selected items, or you put a number larger than the number of selected items you will get an out of bound error. OTOH I guess you already know that!!
Regards
|
|
|
|