|
Find What?
While (true) { Human.isLearnable = true; }
|
|
|
|
|
i have created a DataTable that have a column of type Keys enum, now im trying to select the DataRows by that column but i'm stuck here. Its giving error.
KeyTable.Columns.Add("FirstKey", typeof(Keys));
DataRow[] tmp_dr = KeyTable.Select("FirstKey=" + Keys.LShiftKey);
DataRow[] tmp_dr = KeyTable.Select("FirstKey='" + Keys.LShiftKey +"'");
anyidea guys ? or i should use string type col instead of Keys ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
The underlying type of your enum is Int32, so that's what the column contains.
Either use it that way or use string for the column with:
Keys.LShiftKey.ToString()
|
|
|
|
|
i dont understand it because when i set that datatable to datagridview as datasource it show me string(no numeric value, eg. A B C)
ok nevermind i will use string type column thats looks working...
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Is there any way to change the background colour of individual items in a listBox through code? I know you can do it with the listView control, but I have already built most of the functionality for the listBox, and don't really want to have to redo it.
|
|
|
|
|
|
Set the listBox's DrawMode property to OwnerDrawFixed.
Subscribe to the listBox's DrawItem event.
In the event handler method put this:
if (e.Index % 2 != 0)
{
e = new DrawItemEventArgs(
e.Graphics,
e.Font,
e.Bounds,
e.Index,
e.State,
e.ForeColor, Color.Red);
}
e.DrawBackground();
if (sender is ListBox)
{
ListBox listBox = (ListBox)sender;
e.Graphics.DrawString(
listBox.Items[e.Index].ToString(),
e.Font,
new SolidBrush(e.ForeColor),
e.Bounds);
}
The reason for the new DrawItemEventArgs is that the e.BackColor property is readonly.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
This is sort of what I want, but to be able to change the colour dynamically within the script (but not fixed at start)
|
|
|
|
|
Just alter the condition in the if block - or change to a switch... or whatever you want
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Still not quite. Perhaps I havn't explained properly. I am basically creating an RSS reader. If the post (stored in a static Global list) hasn't been read before, it has a value called 'isNew' set to true - this should mean it will have a background colour other than white. When the user clicks this item, this value will change to false and I want the backing colour (marking it as unread) to change back to white.
Basically, I want to change the colour at various points during the code (not just at initial Draw time).
Thanks.
|
|
|
|
|
You should be able to make it work from what I gave you before. I've expanded it a little to help.
This works for me given your scenario - you should be able to adapt it to suit your existing code.
A basic Feed class:
public class Feed
{
public Feed(string displayText)
{
m_DisplayText = displayText;
isNew = true;
}
private string m_DisplayText;
private bool isNew;
public string DisplayText
{
get { return m_DisplayText; }
}
public bool IsNew
{
get { return isNew; }
}
public void SetRead()
{
isNew = false;
}
public override string ToString()
{
return m_DisplayText;
}
}
This inside the class that holds the ListBox (lstFeeds) and call FillList() after any default initialization.
private Color unreadForeColor = SystemColors.Window;
private Color unreadBackColor = SystemColors.ControlText;
[DefaultValue(typeof(Color), "Window")]
public Color UnreadForeColor
{
get { return unreadForeColor; }
set { unreadForeColor = value; }
}
[DefaultValue(typeof(Color), "ControlText")]
public Color UnreadBackColor
{
get { return unreadBackColor; }
set { unreadBackColor = value; }
}
private void FillList()
{
lstFeeds.DrawMode = DrawMode.OwnerDrawFixed;
lstFeeds.SelectedIndexChanged += new EventHandler(lstFeeds_SelectedIndexChanged);
lstFeeds.DrawItem += new DrawItemEventHandler(lstFeeds_DrawItem);
Feed[] feeds = new Feed[] {
new Feed("Feed A"),
new Feed("Feed B"),
new Feed("Feed C"),
new Feed("Feed D")};
lstFeeds.Items.AddRange(feeds);
}
void lstFeeds_SelectedIndexChanged(object sender, EventArgs e)
{
if (lstFeeds.SelectedIndices.Count > 0)
{
foreach (int selectedIndex in lstFeeds.SelectedIndices)
{
Feed selectedFeed = (Feed)lstFeeds.Items[selectedIndex];
selectedFeed.SetRead();
}
}
}
void lstFeeds_DrawItem(object sender, DrawItemEventArgs e)
{
Feed thisItem = (Feed)lstFeeds.Items[e.Index];
if (thisItem.IsNew)
{
e = new DrawItemEventArgs(
e.Graphics,
e.Font,
e.Bounds,
e.Index,
e.State,
UnreadForeColor,
UnreadBackColor);
}
e.DrawBackground();
if (sender is ListBox)
{
ListBox listBox = (ListBox)sender;
e.Graphics.DrawString(
listBox.Items[e.Index].ToString(),
e.Font,
new SolidBrush(e.ForeColor),
e.Bounds);
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
When I sort columnA in dataGridView, the column sorts properly, but if a lot of values are the same in columnA, the values in columnB are random.
Example:
columnA columnB
a t
a w
a r
a a
a n
a e
b a
b f
b b
c a
d a
How do I get my program to sort so that it will sort columnB after columnA such that:
a a
a e
a n
a r
a t
a w
b a
b b
b f
c a
d a
Thanks in advance.
|
|
|
|
|
Google search for dataGridView1.Sort[^] - the second result was this MSDN page[^].
The very last example at the bottom of the page does exactly what you want.
Remember, always search first before posting. You'd have found it for yourself long ago instead of waiting around hoping someone replies.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Haha, I tried reading the IComparer page before but didn't quite get it. This one was much easier to read, thanks!
|
|
|
|
|
Is there a simple function which will convert a HTML string (including parts such as metachachters into a plain string. Basically stripping tags and replacing metacharachters with their true visual value?
Does this exist in the .Net Framework, or will I hav to build it myself?
Thanks in advance.
|
|
|
|
|
You can use the System.Web.HttpUtility.HtmlDecode method to convert html entities to characters. You can use a regular expression to match the tags to remove them.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
Hi All!
I am trying to create a basic media player, all i want it to do is: play, pause, stop, previous track, nest track, and also let me open multiple mp3 or wma songs and have them displayed in a listView control (the listview control will be acting as my playList). But, I'm having lots of trouble with the project. I can't figure out how to open multiple songs, and dislpay them in listview control. Can somebody please offer me some guidence or samp' code or something to get me started? I'd appreciate any advice/help from anyone, thanks for your time.
Best Regards,
jt.
|
|
|
|
|
I am sure there are several examples at codeproject. A simple search should be able to find them.
|
|
|
|
|
Hi to all,
I have created an Custom UserControl (inherited from UserControl class).
2 Questions,
1. How to hide the (inherited) properties of that control? without using Browseable() property
I didn't get access to any class from System.Window.Forms.Design for ex. ControlDesigner even after adding it's reference
2. How to create usercontrol as serializable &/or deserializable? so that it's properties can be saved programmatically
Regards,
Aniket A. Salunkhe
|
|
|
|
|
No inherited property can be truly hidden. There are several ways to hide them from the designer, but they will still show up in intellisense.
Any derived class should implement anything in its base or call the bases own implementation.
The only true way to not have any properties apart from your own is to build your own from scratch without deriving from UserControl (or Control) or start with Component as it has no properties except Container and Site.
UserControl Inheritance Tree
----------------------------
UserControl : ContainerControl<br />
ContainerControl : ScrollableControl, IContainerControl<br />
ScrollableControl : Control, IComponent, IDisposable<br />
Control : Component, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable<br />
Component : MarshalByRefObject, IComponent, IDisposable
As you can see, there's alot of inheritance going on when you use UserControl
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Can you explain me with example?
using System.ComponentModel;
class TestControl : Container
{
}
Here I am not getting interface for 'Site'.
|
|
|
|
|
using System.ComponentModel;
public class TestControl : Component
{
}
Derive from Component not Container. Any instance of TestControl only has two properties; Site and Container, unless you add more yourself of course.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
hi why this code didn't execute??? what are my errors
using System;
using System.Runtime.InteropServices;
namespace StgOpen
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
public enum STGM:int
{
DIRECT= 0X00000000,TRANSACTED=0X00010000,READ=0X00000000}
[ComImport]
[Guid("0000000b-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPropertyStorage
{
void CreateStream(
/* [string][in] */ string pwcsName,
/* [in] */ uint grfMode,
/* [in] */ uint reserved1,
/* [in] */ uint reserved2,
/* [out] */ out IStream ppstm);
void OpenStream(
/* [string][in] */ string pwcsName,
/* [unique][in] */ IntPtr reserved1,
/* [in] */ uint grfMode,
/* [in] */ uint reserved2,
/* [out] */ out IStream ppstm);
void CreateStorage(
/* [string][in] */ string pwcsName,
/* [in] */ uint grfMode,
/* [in] */ uint reserved1,
/* [in] */ uint reserved2,
/* [out] */ out IStorage ppstg);
void OpenStorage(
/* [string][unique][in] */ string pwcsName,
/* [unique][in] */ IStorage pstgPriority,
/* [in] */ uint grfMode,
/* [unique][in] */ IntPtr snbExclude,
/* [in] */ uint reserved,
/* [out] */ out IStorage ppstg);
void CopyTo(
/* [in] */ uint ciidExclude,
/* [size_is][unique][in] */ Guid rgiidExclude, // should this be an array?
/* [unique][in] */ IntPtr snbExclude,
/* [unique][in] */ IStorage pstgDest);
void MoveElementTo(
/* [string][in] */ string pwcsName,
/* [unique][in] */ IStorage pstgDest,
/* [string][in] */ string pwcsNewName,
/* [in] */ uint grfFlags);
void Commit(
/* [in] */ uint grfCommitFlags);
void Revert();
void EnumElements(
/* [in] */ uint reserved1,
/* [size_is][unique][in] */ IntPtr reserved2,
/* [in] */ uint reserved3,
/* [out] */ out IEnumSTATSTG ppenum);
void DestroyElement(
/* [string][in] */ string pwcsName);
void RenameElement(
/* [string][in] */ string pwcsOldName,
/* [string][in] */ string pwcsNewName);
void SetElementTimes(
/* [string][unique][in] */ string pwcsName,
/* [unique][in] */ FILETIME pctime,
/* [unique][in] */ FILETIME patime,
/* [unique][in] */ FILETIME pmtime);
void SetClass(
/* [in] */ Guid clsid);
void SetStateBits(
/* [in] */ uint grfStateBits,
/* [in] */ uint grfMask);
void Stat(
/* [out] */ out STATSTG pstatstg,
/* [in] */ uint grfStatFlag);
}
[StructLayout(LayoutKind.Sequential)]
public struct STGOPTIONS
{
[FieldOffset(0)] ushort usVersion;
[FieldOffset(2)] ushort reserved;
[FieldOffset(4)] uint uiSectorSize;
[FieldOffset(8),MarshalAs(UnmanagedType.LPWStr)]string pwcsname;
}
[DllImport("ole32.dll")]
public static extern int StgOpenStorageEx([MarshalAs(UnmanangedType.lPWStr)]
string pwcsname,int grfMode,int stgfmt,int grfAttrs,ref STGOPTIONS pStgOptions,
IntPtr reserved2,[In] ref Guid riid,[MarshalAs(UnmanangedType.IUnknown)] out object ppobjectOpen);
}
[STAThread]
public static void Main(string[] args)
{
string file=@"E:\\Miss_Hacker.doc";
int result=StgOpenStorageEx(file,STGM.READ,STGFMT.DOCFILE,2,null,IntPtr.zero,ref IID_IPropertyStorage,out object ppObjectOpen);
Console.WriteLine("{0}",result);
}
}
|
|
|
|
|
First, what does it do? Second, what is it NOT doing?? Third, what do you EXPECT it to do??
Next, why are you not asking the person who wrote it? Found here...[^]
Lastly, why not use Outlook interop to do this instead.
|
|
|
|
|