|
Please see below on what I am trying to do...
Want to get the property value little differently...
Thanks in advance,
Shrini
<br />
class myItem<br />
{<br />
public myItem(){}<br />
public myItem(int EntryID)<br />
{<br />
_EntryID = EntryID;<br />
}<br />
int _EntryID;<br />
public int EntryID<br />
{<br />
get { return _EntryID; }<br />
set { _EntryID = value; }<br />
}<br />
}<br />
}<br />
class myItemList<br />
{<br />
public List<myItem> GetItems()<br />
{<br />
List<myItem> itemCollection = new List<myItem>();<br />
for(int i = 0; i < 5, i++<br />
{<br />
item.Add(i);<br />
}<br />
return itemCollection<br />
}<br />
}<br />
class myClass<br />
{<br />
public void ABCD()<br />
{<br />
myItemList myItems = new myItemList();<br />
List<myItem> Items = myItems.GetItems()<br />
<br />
<br />
<bold>WHAT I WANT TO DO IS HERE...</bold><br />
<br />
I know I can access the Items property like this...<br />
<br />
Items[0].EntryID<br />
<br />
But I want to be able to pass in the name 'EntryID' Dynamically...<br />
<br />
string fld = "EntryID"<br />
<br />
Items[0][fld]<br />
<br />
Is this possible?<br />
<br />
<br />
<br />
}<br />
}<br />
<br />
|
|
|
|
|
Yes, either by using reflection (a bit messy IMO), or implementing an index property in the myItem class:
int this[string key] {
get {
switch(key) {
case "EntryId": return this._EntryID;
default: throw new ArgumentException("No property with the name '" + key + "'.", "key");
}
}
}
---
b { font-weight: normal; }
|
|
|
|
|
Took me little bit of thinking... Ofcourse it is System.Reflection...
What I am doing is some what similar to DTS where you match field names from one database to another for transfering data...
Here I have to match Property names to fields and these names are coming from outside...
<br />
Type type = myItems[0].GetType();<br />
PropertyInfo info = type.GetProperty(PROPERTYNAME);<br />
System.Windows.Forms.MessageBox.Show(info.GetValue(myItems[i], null).ToString());<br />
|
|
|
|
|
Hello everyone!
Iam coding a little tool in C# which could be used as image downloader from websites.
Via httpget I retrieve the pagecontent of the entire website and put all that into a textbox objekt (like a console)
now I want to extract any "http:\\xxxxxxxxxxxxxxxxx.jpg" links and put them into a new string. But I have no idea.
can you help me?
|
|
|
|
|
regular expressions perhaps? you can do pattern matching to get the urls and such. im sure that there is a class out there that will download the actual source of a given webpage, you can then parse that source string to retrieve the href to jpg files. keep in mind that a lot of people are ussing CSS and there might not be any direct links in the source document, you might have to go to the CSS files to find jpg urls...hope thats what you were looking for.
|
|
|
|
|
Yes thats true.
but css is not the problem. the problem is javascript. to download images in javascript links i have to find out the name of the image file (eg: xxxxx.jpg) and then i have to build up a new string containing filename and url.
steps
-----
1. find out jpg filenames
2. build a new string containing filenames and url
3. filter big images (to avoid thumb downloading)
4. perhaps modify filenames (eg: xxxxxxx_thumb.jpg ----> xxxxxx.jpg)
5. download stuff
|
|
|
|
|
ger_creal wrote: I want to extract any "http:\\xxxxxxxxxxxxxxxxx.jpg" links and put them into a new string
Stay tuned for an article (that I'll be uploading very shortly) that will let you do this with ease!
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
|
I am working on my final year project of BS ( computer science) of University of karachi. My project is to deliver application's access rights to any users in the domain dynamically. I know this could be happen by accessing Group policy of any Organizational unit in which that user belong.
but the problem is that , i was unable to access group policy / software restriction policy in C# or any other .net language.
I am accessing active directory in c# using System.DirectoryService namespace. but this could not contain any support of accessing group policy. Pleas help me, my project deadline date is very near.
-- modified at 7:22 Sunday 1st January, 2006
|
|
|
|
|
Hello there!
I want to know is there any possible method to be notified when the computer (which is a member in a LAN) is disconnected?
The program is running on the computer, and I want to be notified when the computer is disconnected and connected.
Thanks
|
|
|
|
|
Hi,
On my C# winforms project I have received some fairly large rounded buttons from the graphics department. Since they are large I cannot cheat and take their rectangular outline as "hotspot" area for mouse enter/leave (to change cursor to hand, and back) and click.
So with other words the code Rectangle.IntersectsWith(Control.MousePosition) doesn't do it for me. I need some code that is Circle.IntersectsWith(Control.MousePosition) .
Did anybody encounter this problem, and has a simple solution for it? Or can give me tips how to handle this problem?
Tnx.
|
|
|
|
|
|
Tnx, I created a GraphicsPath, added an ellipse. From that I created a new Region, and on mouseover I check if the mouseposition is Visible (Region.IsVisible)
|
|
|
|
|
If its a real circle than Pythagoras could help:
public bool IsWithin(Button button, int x, int y) {
int halfButtonSize = button.Width / 2;
int distFromCenterX = x - halfButtonSize;
int distFromCenterY = y - halfButtonSize;
int distFromCenterTotal = Math.Sqrt(distFromCenterX * distFromCenterX
+ distFromCenterY * distFromCenterY);
if (distFromCenterTotal <= halfButtonSize)
OnButtonClick(EventArgs.Empty);
}
|
|
|
|
|
Hi everybody
i work on a project that need notifyicon . i create a form and put a notify control on it every thing was ok since i notice that i can not hide form from user . i don't need form att all so i want to hide it . i test visible , minimize and showintaskbar property of form but at last i noticed that form apeare in switch menu (Alt + Tab ) .
can i hide form or can i use notify without a form ?
please help me
thanks
Regards Amir Jalaly
|
|
|
|
|
Override the OnLoad event of the form. You can change the Opacity of the form to 0 to hide it, or change its Visible property to false. You can also change the forms ShowInTaskbar property to false.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks for your help but i do these form is hided but in alt+tab ( mean switch between forms ) icon of form is apeared
have more suggestion?
Regards Amir Jalaly
|
|
|
|
|
This[^] article on MSDN ought to do the trick.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Tanks
i do all that you say and my problem is solved
but i think that that article is about vb 6 . have any about .net ?
Regards Amir Jalaly
|
|
|
|
|
Yeah, the code is written in VB6, but it demonstrates the technique and is easily converted to VB.NET. All you have to do is put a little effort into it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a project that I am working on that requires me to dynamically create the connection string to a SQL Server database. All of our SQL Servers are published within Active Directory. Within SQL Server there is a tab that allows you to add the instance of SQL to Active Directory. This can also be done for a database after SQL has been added to AD (the options tab at the bottom).
With the database and the SQL instance published in AD I should be able to query AD to find the location of the database, i.e., What server is database X on?, I have looked through System.DirectoryServices and have not been able to find how to do this. Your help is greatly appreciated.
MAGrimsley
|
|
|
|
|
You would have to create a query that returns the SQL database entries. This should be a normal AD query, like any other, returning objects of type 'MS-SQL-SQLDatabase'.
MS-SQL-SQLDatabase[^] schema
Searching Active Directory Hierarchies[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi!
i want to create some link buttons at runtine on click event of one of command button which is placed on the form, at design time. number of link buttons are depends on the requirements from database. problem is that, i write an event handler for all these link buttons, but they are not getting fired. link buttons created perfectly but they dont work. i am writing the code below. somebody help me. its kind of urgent. thanks in advance.
private void btnGo_Click(object sender, System.EventArgs e)
{
Make_Table();
}
private void Make_Table(string SubmitionDate,int TSI,string ExpSheet)
{
HtmlTable tbl=new HtmlTable();
tbl.CellPadding=0;
tbl.CellSpacing=0;
MyHtmlTable.AddRow(tbl);
MyHtmlTable.AddCo(tbl,0,"",SubmitionDate,100,true);
MyHtmlTable.AddRow(tbl);
MyHtmlTable.AddCol(tbl,1,Get_LinkButton(tbl,TSI));
plh.Controls.Add(tbl);
}
private LinkButton Get_LinkButton(HtmlTable InnerTable,int TSI)
{
LinkButton lbtn= new LinkButton();
lbtn.Text="View Time Sheet";
lbtn.ID=TSI+"T";
lbtn.Click+= new System.EventHandler (LinkButton_Click);
return lbtn;
}
private void LinkButton_Click(object sender, System.EventArgs e)
{
//Funtionality of link button.
}
nauman
|
|
|
|
|
Hi,
I'm an italian student.
I've a problem with Windows Media Player component.
I've a Windows Media Player component axWindowsMediaPlayer1 in a form.
I create a graphic on player component:
Graphics dc = this.axWindowsMediaPlayer1.CreateGraphics();<br />
<br />
Color cPen = Color.Red;<br />
float wPen = 2F;<br />
Pen pen1 = new Pen(cPen, this.wPen);<br />
<br />
Rectangle area = new Rectangle(new Point(x, y), new Size(h, l));<br />
<br />
dc.DrawEllipse(pen1, area);
I view the graphic normally, but if I set the URL property of player component with
this.axWindowsMediaPlayer1.URL = "video01.wmv";
the video overwrite the graphic.
I need that the graphic is over the windows media player component, but I not be able to this.
Please help me. Thanks.
P.S.: Scuse me for my english.
Giuseppe T.
|
|
|
|
|
media player(or any others) plays video or audio just like that:
1) initate and build a directshow or so like graph that has suitable filters for inherent video ,audio streams in file
2) run the graph and have frames or samples on an uncompressed memory buffer
3) copy this buffer(directX buffers) to suitable destination (windows dc )
that means internal structure will always override the windows buffer you have on screen by default.
but if u put a timer and paint just after the frame refresh u might...
or somehow get that unmanaged buffer from media player somehow...
overall; professional solution is to access the real video buffer that is being done enough well only on ;unmanaged C++ by writing a mixing filter.
Mikail Çetinkaya . The C# DEveloper
|
|
|
|