|
As far as i am aware, the standard way of doing it would be have your query / SP text that u will be using to populate your data. On select, read the key out of the selected item, and insert it into your query string, and execute.
i.e.
<br />
protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)<br />
{<br />
const int DEFAULT = 0;<br />
const string SQL = "EXEC GetStateListByID {1}"<br />
<br />
int liIndex;<br />
string lstrSQL;<br />
<br />
liIndex = (int)DropDownList1.SelectedItem.Value;<br />
<br />
if(liIndex == DEFALT)<br />
return;<br />
<br />
lstrSQL = string.Format(SQL, liIndex)<br />
<br />
<br />
this.PopulateDataGrid(lstrSQL);<br />
<br />
}<br />
<br />
That's the simple version anyway. Hope it helps.
Tris
|
|
|
|
|
Thanks a lot.
I am working with n-tier and also Controll - model MSUserInterfaceProcess and from business tier I get dataset back. So I can't use the direct query but this gave me an another idea to try. Thanks a lot again. I was stuck but your suggetion triggered a new thought process.
Thanks
|
|
|
|
|
Hi All,
I have two multiline textboxes one above the other that both have horizontal scroll bars.
How would I make it so that when one scroll bar is moved, the other textbox's scroll bar is also automatically adjusted so that they always line up?
Thanks
|
|
|
|
|
Hi
I've the following line:
MethodInfoArray[i].Invoke(new object(),datafrominputs);
where datafrominputs is an object[] containing 2 or more items. I defined the method it is invoking like this:
static public int function(params int[] numbers)
Am I correct in assuming this will allow any number of inputs? why do I get a TargetParameterCountException?
cheers
|
|
|
|
|
datafrominputs needs to be object[][] of size 1 and the original object[] should be the first element. iow:
MethodInfoArray[i].Invoke(new object(), new object[] { datafrominputs });
|
|
|
|
|
I have to parse some XML files (more than 5.000 files). All of them are compressed with gzip, and so does the DTD of each one.
Using GZipStream, I can read the XML (i'm using XPathDocument), but it generates an exception "Expected DTD markup was not found", because the DTD also is gzipped.
I did a test, replacing the DTD of one XML with a normal file (not compressed), and it worked.
Is there any way to parse these XML files without having to extract the DTD, decompress them and modify the DTD reference in the XML files?
Thanks in advance!
|
|
|
|
|
I have an interface defined called A
Its class behind it is class B.
I do not allow direct creation of this class.
But, I need to allow the classes to grab events from there.
Can I define events for an interface?
Or whats the best pattern to implement to allow for such events, without making the class publicly creatable?
Thanks,
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
Ista wrote: Can I define events for an interface?
Sure you can. Syntax is nearly the same as for normal classes. Just leave the visibility modifier away.
|
|
|
|
|
actually no. If you define an event it will think its a field. Which is ilegal in an interface.
Unless you know of a different way
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
public interface ITest {
event EventHandler MyEvent;
}
public class TestA : ITest {
public event EventHandler MyEvent;
}
... works or am I totally misunderstanding you?
|
|
|
|
|
your right. sorry.
I didnt put the handler in and wasn't paying attention I guess.
Thanks.
I created an observer class instead
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
I want to set text button to specific date, I want to set it to always show
for examle the date of monday or tuesday.
It should looks like this button1.Text=...
What I need to type in.
I tried but I know only how to set it to current date.
In my project I want to looks like this
I have seven buttons, and each button.text sholud be equal to other day of week
button1 to date of monday's etc.
How can i do this??
Please help.
|
|
|
|
|
Hi there!
If i understood correctly you want for example
Button1.Text = "5/29/06"
Button2.Text = "5/30/06"
and so on... for complete week!
This isn't very difficult (just a small example)
private void Form1_Load(object sender, EventArgs e)
{
button1.Text = DateTime.Today.ToString();
button2.Text = DateTime.Today.AddDays(1).ToString();
button3.Text = DateTime.Today.AddDays(2).ToString();
}
the AddDays increase the actual Date by the value you paste in... hope that's what you asked for... the ToString() converts the date into a text string, so that the button can handle it!
Bye!
FreewareFire is in the House!
|
|
|
|
|
|
Hi everyone.
I've written a small app to help my wife rename her thousands of images. She used to do it by hand 0.o.
Anyhow, the app seemed to work just as it should, until we noticed that I had programmed it to check on creation date, and not on "image / picture taken" date. So when she retrieves the images from the camera they all get current date.
I've noticed that when I browse pictures with win XP, there's a column called "Picture or Image taken". (I've got it in norwegian, so I'm not sure what it says in english).
Does anyone know how to extract this data? Which class / methods to use to get the "Picture taken" date.
Big thanx in advance!
-Larantz-
|
|
|
|
|
|
Thanx for the reply.
I'll check it out as soon as i get back from work.
Hope the "date time" field returned from this class is the "picture taken" property I'm after,
and not just creation time.
*fingers crossed*
-Larantz-
|
|
|
|
|
If your camera's like my camera, I'm pretty sure it is
|
|
|
|
|
Im trying to read the myapplication.exe.config file using the ConfigurationManager class.
the myapplication.exe.config file looks like that -
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="LogDirectory" value="C:\Documents and Settings\\logs\" />
<add key="LogFileName" value="MYLOG.log" />
</appSettings>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network
host="localhost"
port="25"
defaultCredentials="true"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>
in the code i defined the configuration file and managed to get the net section by -
System.Configuration.Configuration ConfigurationFile = ConfigurationManager.OpenExeConfiguration(@"C:\Documents and Settings\myapplication.exe.config");
ConfigurationSection netSection = ConfigurationFile.GetSection(@"system.net/mailSettings/smtp");
but how do i get the host and the post ???
thanks
Shaul zak
Software engineer
www.Unipier.co.il
-- modified at 14:57 Sunday 28th May, 2006
|
|
|
|
|
please anyone ??
Shaul zak
Software engineer
www.Unipier.co.il
|
|
|
|
|
Hi there!
I'm currently have a problem:
I've looked about 2 days about any solution and failed...
I want to execute an application outside of my program and want that this application gets an mdi child in my own form.
For example:
I start my own program... Then I execute Notepad... Now i want that Notepad gets an mdi child in my program. I've looked at SetParent, but i can't get a working solution. If someone has some Code or any suggestion, please let me know!
Thank you!
FreewareFire is in the House!
|
|
|
|
|
just so far... i got it...
add that dll call:
[DllImport("user32.dll", SetLastError = true)]
private static extern long SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
and then use something like that:
Process[] AllProcesses = Process.GetProcesses();
foreach (Process xProcess in AllProcesses)
{
if (xProcess.ProcessName == "notepad")
{
SetParent(xProcess.MainWindowHandle, this.Handle);
}
}
don't forget to set IsMdiContainer to true!
FreewareFire is in the House!
|
|
|
|
|
Hello!
I'm trying to create a color wheel like this one, but I can't get it just right. I've managed to get a star, a cube and pretty much every shape except the one found in that link. I'm using GDI+.
I have some code here:
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
Graphics g = e.Graphics;<br />
SolidBrush b = new SolidBrush(Color.Transparent);<br />
<br />
Point[] points = new Point[4];<br />
Colors.HSL hsl = new Colors.HSL();<br />
hsl.S = 1;<br />
hsl.L = 1;<br />
<br />
for (int i = 0; i < 23; i++)<br />
{<br />
points[0].X = Convert.ToInt32(Math.Floor(Math.Sin(i - 7.5) * 24)) + (this.Width / 2);<br />
points[0].Y = Convert.ToInt32(Math.Floor(Math.Cos(i - 7.5) * 24)) + (this.Height / 2);<br />
<br />
points[1].X = Convert.ToInt32(Math.Floor(Math.Sin(i + 7.5) * 24)) + (this.Width / 2);<br />
points[1].Y = Convert.ToInt32(Math.Floor(Math.Cos(i + 7.5) * 24)) + (this.Height / 2);<br />
<br />
points[2].X = Convert.ToInt32(Math.Floor(Math.Sin(i - 7.5) * 100)) + (this.Width / 2);<br />
points[2].Y = Convert.ToInt32(Math.Floor(Math.Cos(i - 7.5) * 100)) + (this.Height / 2);<br />
<br />
points[3].X = Convert.ToInt32(Math.Floor(Math.Sin(i + 7.5) * 100)) + (this.Width / 2);<br />
points[3].Y = Convert.ToInt32(Math.Floor(Math.Cos(i + 7.5) * 100)) + (this.Height / 2);<br />
<br />
hsl.H += 0.043;<br />
b.Color = Colors.HSL_to_RGB(hsl);<br />
<br />
g.FillPolygon(b,points,System.Drawing.Drawing2D.FillMode.Alternate);<br />
}<br />
}
The problem is the part with point[x]... part, I don't know how to get it right. It would be great if someone could show me how to create a ball with 24 diffrent hues, theory or code it doesn't matter.
Regards,
Martin
-- modified at 14:22 Sunday 28th May, 2006
|
|
|
|
|
Assuming you will overpaint the interior in the next step the following will work:
Point[] points = new Point[3];
int stepCount = 24;
double degreePerStep = 2 * Math.PI / stepCount;
int width = this.ClientSize.Width;
int height = this.ClientSize.Height;
for (int i = 0; i < stepCount; i++)
{
double sizeFactor = i % 2 == 0 ? 2.0 : 2.2;
points[0].X = (int)(width / 2.0);
points[0].Y = (int)(height / 2.0);
points[1].X = points[0].X + (int)((Math.Sin((i + 0.5) * degreePerStep)) * width / sizeFactor);
points[1].Y = points[0].Y + (int)((Math.Cos((i + 0.5) * degreePerStep)) * height / sizeFactor);
points[2].X = points[0].X + (int)((Math.Sin((i - 0.5) * degreePerStep)) * width / sizeFactor);
points[2].Y = points[0].Y + (int)((Math.Cos((i - 0.5) * degreePerStep)) * height / sizeFactor);
b.Color = colors[i % colors.Length];
g.FillPolygon(b, points, System.Drawing.Drawing2D.FillMode.Alternate);
}
I also suggest using antialiasing:
g.SmoothingMode = SmoothingMode.HighQuality;
and don't forget to dispose the your brush .
|
|
|
|
|
Thank you very much! I will dispose the brush, don't worry . I will try it when I get the time to, I have to go now.
- Martin
-- modified at 10:37 Monday 29th May, 2006
|
|
|
|