|
Thats the whole point, I want to do what Enabled=false does, but without the graying out. Also the Forms move, resize min, max function should be enabled with the right cursor.
|
|
|
|
|
Hi friends
I have a multiselect listbox
and i am sending selected data to my sql
but when user want to retrive the data how can i select multiple rows.
suppose i have a listbox and its rows are
abc
xyz
pqr
user select 'abc' and 'pqr' and save the data
after some time user want to see that details
no i have data in database 'abc' & 'pqr'
but how can i set multiple data in list box
on page load i have to select 'abc' and 'pqr'
how this i possible
Thanks
|
|
|
|
|
To set multiple selections in a list control programmatically
Loop through the control's Items collection and set the Selected property of every individual item.
Note You can only select multiple items if the control's SelectionMode property is set to Multiple.
The following example shows how you can set selections in a multi-selection ListBox control called ListBox1. The code selects every other item.
' Visual Basic
Protected Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim li As ListItem
For Each li In ListBox1.Items
i += 1
If (i Mod 2 = 0) Then
li.Selected = True
End If
Next
End Sub
// C#
public void Button1_Click(object sender, System.EventArgs e)
{
// Counter
int i = 0;
foreach(ListItem li in ListBox1.Items)
{
if( (i%2) == 0)
{
li.Selected = true;
}
i += 1;
}
}
I hope this will solve ur query.
I do not know any other way of doing it. If u find one let me know
ref: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskdeterminingselectioninlistbox.asp
Cheers,
Mohit
|
|
|
|
|
How to create MSN Messenger type status bar popup message box in C# or VB.NET?
Thanks in advance
|
|
|
|
|
dashingdracula wrote:
How to create MSN Messenger type status bar popup message box in C# or VB.NET?
Your answer is already here in CP. Be sure to always search first:
Try Here![^]
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
hi!!
my new project involes accessing a remote SQL server using ADO.net and displaying the information in Microsoft Excel.but the code must not be accessible thru access.
it'll be great if u could help with an idea..
thanx...
shweta.
|
|
|
|
|
//vc++:
FormatMyDisk(char * TransData, char* VolumeName)
{
char *FormatW2K = "CMD.EXE";
char FormatW2KParam[100] = {0};
sprintf(FormatW2KParam, "/C \"format.com %c:/q/x/FS:FAT/V:%s\"",*TransData,VolumeName);
ShellExecute(NULL,"open", FormatW2K, FormatW2KParam, NULL, SW_SHOW);
}
what does the identical C# code look like?
|
|
|
|
|
Take a look at the Process and ProcessStartInfo classes which provide everything needed to replace the ShellExecute.
The rest is some simple string concatenation you should be able to do yourself.
www.troschuetz.de
|
|
|
|
|
My question is that I have to print a string from server side C#
if(e.CommandName =="Print")
{
string parsedreceipt = null;
parsedreceipt = DecodeReceipt (e.Item.Cells[3].Text);
===> here I need to print to the printer and pass the string
parsedreceipt which is the information that I want to print.
}
I need your help badly on this one.
Here is my function:
public void ReceiptsDataGrid_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
ListItemType oType =
((ListItemType)e.Item.ItemType);
if(oType == ListItemType.Item || oType ==
ListItemType.AlternatingItem)
{
e.Item.Attributes.Add("onmouseover",
"this.style.backgroundColor='lightblue'");
e.Item.Attributes.Add("onmouseout",
"this.style.backgroundColor='Beige'");
}
if(e.CommandName =="View")
{
string parsedreceipt = null;
parsedreceipt = DecodeReceipt
(e.Item.Cells[3].Text);
StringBuilder strAlert = new
StringBuilder();
strAlert.Append("<script
language=javascript> alert('");
strAlert.Append("Receipt:" + parsedreceipt +
"\\n");
strAlert.Append("');");
this.RegisterStartupScript("startup",strAlert.ToString());
}
if(e.CommandName =="Print")
{
string parsedreceipt = null;
parsedreceipt = DecodeReceipt
(e.Item.Cells[3].Text);
}
}
Any help would be appreciated.
|
|
|
|
|
I have a base class, that defines an Enum.
I have one or more sub classes that redefine that Enum (using the new keyword).
I am trying to write code in the base class to iterate through the enum, as defined by the subclass that is calling the code.
Any ideas how? I'm trying to work my way through Reflection, and I can get all of the properties and methods, but cant get any info about any Enums that might be there.
Thanks
--
Dave
|
|
|
|
|
In case anyone cares:
Type[] tNested = this.GetType().GetNestedTypes(System.Reflection.BindingFlags.NonPublic);
object rt = null;
foreach (Type t in tNested)
{
rt = Activator.CreateInstance(t);
break;
}
--
Dave
|
|
|
|
|
Hi everybody.
I'm trying to create a web application with C#.net or C++ like the (windows updates from Microsoft) to let the customer of our company download automatically our executables files from the web and also let the web app automatically the install those files on their computers.
If somebody has any idea of how to do it or any source code about it, I’d appreciate.
Thanks
Ali Hidalgo
|
|
|
|
|
Well Windows Update uses a service called Background Intelligence Transfer Service (BITS). You can use this to download files or updates, then you'll have to write some code to update your application. Of course you dont have to use BITS, you can write your own downloader or use WebClient.DownloadData/File if you dont mind it holding up your app...
Dan
|
|
|
|
|
Hi gurus,
With WMI and C#, how can I detect if a network adaptor is a virtual or physical?
Thanks.
Best regards.
There is no spoon.
|
|
|
|
|
You can't check for a flag like that, but you can use the available information to POSSIBLY figure it out. Most virtual adapaters will not have an AdapterType in their Win32_NetworkAdapter class. Physical adpaters usually will. For example, you could check each adapter for an "Ethernet 802.3" Adapter Type.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
It seems that I have the correct information when I do the following SQL statement on WMI:
SELECT Description, IPAddress FROM Win32_NetworkAdapterConfiguration WHERE ((DHCPEnabled = 'TRUE') AND (IPEnabled = 'TRUE'))
But I don't know if it will work on manually configured ethernet adapters.
When I do a request on Win32_NetworkAdapter class with the AdapterTypeID set to 0 (Ethernet 802.3) I get back the 1394 adapters and a lot of other adatper types while I need only to retrieve physical network Ethernet adapters (no virtual ones).
There is no spoon.
|
|
|
|
|
No, it won't. Even VPN adapters can have those properties set to True. Also, not all properties of the class are set by the drivers manufacturers. AdapterTypeID, since it is available in XP and above only, might not be set. It, also, does not support a NULL value, so if it is not set properly, or at all, it defaults to 0. Use the string parameter AdapterType instead.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Gurus,
What is the equivalent of the MFC's combo member SetItemData and GetItemData in C# for combo boxes?
Thanks.
Best regards.
There is no spoon.
|
|
|
|
|
Hi - not a guru here but what I use to populate a combobox is: combobox.Items.Add([value]);
Not sure what you need to use to replace GetItemData I use an equivilency test eg: if([value].Equals(combobox.Text))...ect but there maybe a better way.
Hope this helped
|
|
|
|
|
Hi,
thanks.
I have found how to add personal data to combo box items
thanks anyway
There is no spoon.
|
|
|
|
|
bouli wrote:
I have found how to add personal data to combo box items
I don't know if it is what you found out, but you can add any object to a ComboBox , and it's the result of calling that object's ToString() what gets displayed in the ComboBox .
So, just create a little class that contains all your data in public fields (or properties or whatever) and override the ToString() member. Add objects of that class to the ComboBox , and that's it.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hi,
This is exactly what I have done
There is no spoon.
|
|
|
|
|
Hello everybody. I'm writing from Seville, Spain. I'm trying to build a Test-generator application through a shared add-in hosted in Word, and I need to transform .xml documents to other formats like .doc, .html and .rtf. I'm convinced that possibly there are libraries, components or classes that allow these transformations.
Does anybody know something about this respect??
Has anybody ever been in a similar situation??
Thank u very much
|
|
|
|
|
xml->html = xslt
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
C# code:
public static System.UInt16 MAKEWORD(byte a, byte b)
{
return (ushort)a | ((ushort)b << 8);
}
when compiling,the error "can not implicitly convert type 'int' to 'ushot'" occur.
what's the problem?
|
|
|
|