|
Hello
My question wasn't if you have other errors or not!! My question was where exactly you get this error??
1- When you start your applications?
2- When you try to read/get data?
3- When you try to update data?
4- After staying idle -with no operations- for a while? How long?
5- When you close your application?
Two more questions:
1- Do you make your connection using the designer or in the code?
2- Is your application multithreaded? ie. Do you access the connection on multiple threads?
Regards
|
|
|
|
|
Hi...
In my application I have some listviews. I wanted to improve their appeareance adding an image to the headers. This is easy using smallimagelist of the listview class. The problem is that I want to show the sort arrow. For this I do it in this way:
IntPtr hHeader = Win32.SendMessage(this.Handle,Win32.LVM_GETHEADER,IntPtr.Zero,IntPtr.Zero);<br />
.<br />
.<br />
(more code)<br />
.<br />
.<br />
.<br />
Win32.SendMessage2(hHeader,Win32.HDM_SETITEM,new IntPtr(columnIndex),ref hd);
But when I click a header, the images dissapears.
Does anybody know a solution for this issue?
thanks
|
|
|
|
|
Hello
I assume you are using dllImport to send that message to your header cell. Why?? You can use myList.Columns[X].ImageIndex to show the arrow in your imagelist and change the arrow image in the ColumnClick event. Anyway, if you still want to use messages, try to resend the message in the click event handler.
PS.
What is Win32.SendMessage ??
Where do you put the above code?
Did you handle the ColumnClick event?? If so what do you do in it concerning the painting?
Regards
|
|
|
|
|
Of course, I´m using dllimport and I handled the ColumClick event. Win32 is only a class that hosts dllimports and other stuff. I know I can use ImageIndex to show the arrow. But... what I want is...to show an image and the arrow, at the same time.
What I want is something like this: http://www.codeproject.com/cs/miscctrl/XPTable.asp. But with listview 2.0.
kind regards and thanks for your answer
|
|
|
|
|
Hello
Well, one easier solution is:
1- Get the image from your ImageList;
2- Use a Graphics object to draw the arrow with the proper direction at the proper place of the image.
3- Show the image in your header!!
This way you won't need to use unmanaged calls!!
Regards
|
|
|
|
|
Using the native sending of messages is uncalled for here.
It is vanishing because the same init is not being persisted.
You need to couple creation message with every other message, if you insist in sending antive messages.
Though i can see two more ways of achieving the same result, though from unmanaged apps.
Excelsior
Arjun Bahree
"By The Might of Mjolnir"
I Came! I Coded! I Conquered!
|
|
|
|
|
Hi guys;
I was wondering if there is a 2D graphics via Direct3D engine or library that I could use.
I saw a site on this but the dll only works for the VB6 not C#.
www.dxgame.com[^]
I need something like the above but for use in C#.
Thanks
Hadi
|
|
|
|
|
Hello
Did you try to reference to it? Dlls in any language can still be used in C# if they support COM. Otherwise try using DllImport.
Regards
|
|
|
|
|
Yes its a piece of cake.
You have tons of game engines in the market that you can use for the same, through Interop. Also you can use the DirectX wrapping assemblies for achieveing the same results. I have created many DX based apps in the past using C# and though the performance is not as expected in lieu of the native version, still its respectable
Excelsior
Arjun Bahree
"By The Might of Mjolnir"
I Came! I Coded! I Conquered!
|
|
|
|
|
Have you looked at Microsoft's recently released XNA[^] Game Studio?
|
|
|
|
|
I want to show one of the frames(First frame for example) of a video as a still image in windows media player control.( I have set the URL of the control to the video file address. Playing the video and pausing didn't work )
I would be so happy if anybody have any idea.
Yasamin
|
|
|
|
|
Hello
Since no one replied for more than 5 hours I'd try -as much as i can- guide you to what I think..
Media player be default -just as any other media player BTW- displays the video by hardware acceleration. This means that it doesn't just display a sequence of still images, when you pause it it will keep displaying the last one!! Anyway, if you want to display a still frame of a video you'd beter use managed DirectX library. Revise the video section in C# multimedia articles for more informations.
Regards
|
|
|
|
|
Simple. Get the pointer to the Frame buffer through the WM API. Then from that display the first entry through Render call. It shall be done. Clicking on Play will restart the movie from the beginning though. To circumvent, put in a WM Hook to intercept the play button click, and continue from second frame onwards.
I kno it seems a little complex, but trust me its easy adn you can find built code fo this.
Excelsior
Arjun Bahree
"By The Might of Mjolnir"
I Came! I Coded! I Conquered!
|
|
|
|
|
hi all,
I have a custom ASP.NET server control (don't worry the question is primarily about reflection, not ASP.NET) that I want to dynamically wire up events to using the designer.
Basically it works like this:
I have my Control on the Page, and through the Property Browser in the Designer, you can set the 'Trigger' to show the Control via a dropdown list of the Controls ID's on the Page. (similar to the ControlToValidate Property of a Validator Control).
Then in code I dynamically wireup the event like so:
private void RegisterControlEvent()
{
Control control = this.NamingContainer.FindControl(ControlTrigger);
if (control == null) { return; }
string eventName = ControlCoverter.GetEventName(control);
if (eventName == string.Empty) { return; }
EventInfo ei = control.GetType().GetEvent(eventName);
Delegate del = Delegate.CreateDelegate(ei.EventHandlerType, this, "Control_TriggerEvent");
ei.AddEventHandler(control, del);
}
now this works fine, fo a System.Web.UI.WebControls.Button because the Click event Delegate is the same as mine, which is (simplified for brevity)
void Control_TriggerEvent(object sender, EventArgs e)
{
Show();
}
but I need to be able to dynamically detect the event Delegate and change the function accordingly, like for an System.Web.UI.WebControls.ImageMap the required delegate is
protected void ImageMap2_Click(object sender, ImageMapEventArgs e)
{
}
so the button event works fine, but not for anything having a different delegate, the objective is to be able to support any WebControl / Control that has an event registered within my ControlConverter class.
can anyone help me on acheiving this please?
my ControlConverter class is as follows:
public class ControlCoverter : ControlIDConverter
{
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
if (context == null) { return null; }
IDesignerHost host1 = (IDesignerHost)context.GetService(typeof(IDesignerHost));
if (host1 == null) { return null; }
string[] textArray1 = this.GetControls(host1, context.Instance);
if (textArray1 == null) { return null; }
return new TypeConverter.StandardValuesCollection(textArray1);
}
private static readonly string[] EventTriggers = new string[]
{
"Click", "SelectedIndexChanged", "CheckChanged", "ServerClick", "ServerChange",
};
private string[] GetControls(IDesignerHost host, object instance)
{
IContainer container1 = host.Container;
IComponent component1 = instance as IComponent;
if ((component1 != null) && (component1.Site != null)) { container1 = component1.Site.Container; }
if (container1 == null) { return null; }
ComponentCollection collection1 = container1.Components;
ArrayList list1 = new ArrayList();
foreach (IComponent component2 in collection1)
{
Control control1 = component2 as Control;
EventInfo[] eventInfo = control1.GetType().GetEvents();
bool supportsEvent = false;
foreach (EventInfo ei in eventInfo)
{
string eventName = ei.Name;
if (Array.IndexOf<string>(EventTriggers, eventName) != -1)
{
supportsEvent = true;
break;
}
}
if ((((control1 != null) && (control1 != instance)) && ((control1 != host.RootComponent) && (control1.ID != null))) &&
((control1.ID.Length > 0) && this.FilterControl(control1)) &&
(supportsEvent))
{
list1.Add(control1.ID);
}
}
list1.Sort(Comparer.Default);
return (string[])list1.ToArray(typeof(string));
}
public static string GetEventName(Control control)
{
EventInfo[] eventInfo = control.GetType().GetEvents();
foreach (EventInfo ei in eventInfo)
{
string eventName = ei.Name;
if (Array.IndexOf<string>(EventTriggers, eventName) != -1)
{
return eventName;
}
}
return string.Empty;
}
}
kind regards,
g00fy
|
|
|
|
|
void SomeMethod(){
EventInfo ei = GetSomeEventInfo();
MethodInfo mi = ei.GetRaiseMethod(true);
Type typeRet = mi.ReturnType;
ParameterInfo[] arr_Parameters = mi.GetParameters();
// now you have all required info about handler method declaration
}
Geniality is in simplicity.
|
|
|
|
|
I ahve Xp prof and running VC# -2003. every time I try to debug it says unable to debug application.
I also have VS-2002 Installed on the same machine- ihave the same problem with that- any ideas.
Tapas Shome
System Software Engineer
Keen Computer Solutions
1408 Erin Street
Winnipeg, Manitoba
Canada R3E 2S8
www.keencomputer.com
|
|
|
|
|
Two thoughts
1 - is it a debug version
2 - is it building OK ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Yeah, it builds app OK. and Runs OK. Only Debugging Hassle. I am applying the Upgrade Patch.
Tapas Shome
System Software Engineer
Keen Computer Solutions
1408 Erin Street
Winnipeg, Manitoba
Canada R3E 2S8
www.keencomputer.com
|
|
|
|
|
But it's a debug version ? What's the error ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Which kind of application you trying to build?
Web or Win?
Different scenarios for different types of applications. Also myriad reasons for the debug not to work.
Post the exact problem and I am sure we can help you with that.
Excelsior
Arjun Bahree
"By The Might of Mjolnir"
I Came! I Coded! I Conquered!
|
|
|
|
|
Hi everybody!
I'm using smtp client to send an email.
but for my surprise, even though I'm clicking the button that gives the command to send an e-mail, the e-mail itself is not sent until the application is closed!
that is extremly weird, does anyone have an idea how to overcome this problem, or maybe have encountered it?
Thanks!
|
|
|
|
|
Hello
Well, do you use Send() or SendAsync()? as another way of knowing what's wrong try to make a breakpoint when you click the button and monitor the code excutiong setp by step. Also if you handle the closing event and/or the dispose of the smtpclient, another breakpoint would be handy!
Regards
|
|
|
|
|
I'm using Send().
I debugged it, and it simply reads through the smpt.Send() and does nothing. It seems like it queues the sending till I close the application.
|
|
|
|
|
Hello
Well, err... I got one stupid solution but may work!! Make a smtpClient for each message, and after sending the message, dispose that client!! Maybe somehow in your code you got it to sned upon disposal!!
PS.
Have you entered any code in the dipose/closing methods?
Regards
|
|
|
|
|
I thought about it, but it seems that there is no dispose method! (thats even more weird!)
|
|
|
|