|
Your code here does not show HibernateDAO as static. Also it cannot be static as written due to the generics.
You have to make the class a strong type and define it explicitely as static in order to get a static class.
All you've done is define a static method inside an instance class.
You need something like this:
public static class Hibernate
{
...
}
|
|
|
|
|
Hi,
I have the following problem. On a page I have a multiple selection listbox.
It contains a lot of items. When items near the bottom are selected, and I
do a button click, the control jumps to the top. If there are a lot of items,
this can get very annoying, always having to scroll down to the selected
items (if I want to change them, or something).
Is there any solution so that after button click also the mouse position
remain unchanged.
Thanks & Regards
Mishra
|
|
|
|
|
Ballita wrote: Hi,
I have the following problem. On a page I have a multiple selection listbox.
It contains a lot of items. When items near the bottom are selected, and I
do a button click, the control jumps to the top. If there are a lot of items,
this can get very annoying, always having to scroll down to the selected
items (if I want to change them, or something).
Is there any solution so that after button click also the mouse position
remain unchanged.
Lookup EnsureVisible
|
|
|
|
|
Could you please describe how can i use that.
Thanks & Regards
Mishra
|
|
|
|
|
Ballita wrote: Could you please describe how can i use that.
Did you look it up? What did you find? Where are you stuck?
|
|
|
|
|
hi,
how can i change the regional settings, input locale programatically using c#. input locale has to be applied for the Operating system level. plz help me out..
Thanks in advance.
hemanth
|
|
|
|
|
g_hemanth17 wrote: hi,
how can i change the regional settings, input locale programatically using c#. input locale has to be applied for the Operating system level. plz help me out..
You can create a CultureInfo class and assign to the current thread... is that what you are looking for?
|
|
|
|
|
Thanks for your reply, using cultureinfo we can change the userinterface and IME for the particular form. but i want to change the whole operating system input locale. how could i do that one.
thanks in advance.
hemanth
|
|
|
|
|
If the FormBorderStyle of the main form is set to None, the context menu on the taskbar is no longer accessible, which normally has menus Restore, Minimize, Move and Close when you right-click it.. is there a way at C# to still be able to display the context menu when the FormBorderStyle is set to None?
|
|
|
|
|
I have .NET 3.5 WinForms application. This contains form with
horizontal SplitContainer.
I set SplitterDistance to 30 in OnLoad()
However its value is 41 on OnFormClosing().
I want to obtain original value (30) for restore.
Any idea why value is changing automatically and how to get real value ?
It is interesting that SplitterDistance increases not by certain number of
pixels but by some factor.
First increase is from 30 to 41, i.e 11 pixels.
Seceon increase is frm 41 to a larger number of pixels.
This increasing seems to stop when SplitterDistance reaches to the value
which is set in Form Designer.
protected override void OnLoad(System.EventArgs e) {<br />
base.OnLoad(e);<br />
splitContainer1.SplitterDistance = 30;<br />
}<br />
<br />
protected override void OnFormClosing(FormClosingEventArgs e) {<br />
Settings.SplitterDistance = splitContainer1.SplitterDistance;<br />
base.OnFormClosing(e);<br />
}
Andrus
|
|
|
|
|
When using a split window, the splitter will begin with the distance you provide it.
However it reacts based on changes to the forms in each panel. Adding a larger control to the top panel can push down the splitter as well as resizing the window. (Resize will cause it to try and maintain some type of relational sizing to the original size you created at design time) I found this out when building an 'Outlook-like' application and the button panel kept changing sizes.
I fixed the problem by hooking into the Resize event. Every time the form containing the split windows did a resize, I reset the splitter distance to the preferred location.
|
|
|
|
|
Thank you.
I changed setting to hold persent and added following code to resize method. Every time I re-open the form, Splitter moves up by a number of pixels. So top area becomes smaller and smaller until reaches to minimum height.
How to fix this ?
I have simple form containing ToolStrip and single horizontal splitter with DockStyle set to Fill. Top spitter are contains DataGridView and nbottom area contains multiline TextBox both with DockStyle set to Fill.
protected override void OnResize(EventArgs e) {<br />
if (Settings != null && Settings.SplitterDistance > 0m &&<br />
Settings.SplitterDistance < 100m) splitContainer1.SplitterDistance = (int)(Settings.SplitterDistance * (decimal)splitContainer1.Height / 100m);<br />
<br />
base.OnResize(e);<br />
}
Andrus
|
|
|
|
|
In this example, you are computing the distance instead of defining a specific distance. So what is happening with this:
protected override void OnResize(EventArgs 3)
{
if ( Settings != null && Settings.SplitterDistance >0m && settings.SplitterDistance < 100m)
splitContainer1.SplitterDistance = ....your math
base.OnResize(e);
}
First you say you are only going to calculate a splitter distance if the distance is less than 100m.
You then compute by multiplying the distance by the height/100m. Your height is just a teensy bit smaller than your splitter distance.
So your height/100m will be a decimal since the height of splitcontainer1.Height being less than 100 causes the splitter distance to be less than 100. Not only will it be a decimal but it will be a decimal less than 1.
So now when you compute the splitter distance you are shrinking the distance by whatever the decimal amount is. So if my height is 50 then you've just moved in the splitter distance by 50%. ( distance * 50/100 -OR - distance * .50 )
Now you do something causing another resize event. Assuming you did not move the splitter itself then you are guaranteed of the fact that you are less than 100m. So when you catch that event you will move it once again.....only a smaller percentage this time. But each time you move it you will make it smaller and smaller because you are mulitplying it by a number smaller than 1.
Either do one of two things: leave it be where it ends up -- or determine a good place to have it in a fixed location. So maybe having it 100 pixels out is good. Then set the splitter distance to 100 every time you get a resize (unless the entire window is less than that).
|
|
|
|
|
First you say you are only going to calculate a splitter distance if the distance is less than 100m.
No. Settings.SplitterDistance holds now upper pane height persent in range 0 .. 100% . I changed its name to SplitterDistancePercent.
Now you do something causing another resize event.
I do'nt understand this. Why you think that changing Splitcontainer SplitterDistance causes form resize event ?
leave it be where it ends up
My issue is that it does not remain in same place but moves up by some pixels every time form is re-opened.
determine a good place to have it in a fixed location
I need to allow end user to determine the good place by moving splitter by mouse at runtime. I save form splitter distance percent in form close event:
protected override void OnFormClosing(FormClosingEventArgs e) {<br />
Settings.SplitterDistancePercent = splitContainer1.SplitterDistance * 100m / splitContainer1.Height;<br />
SaveSettings();<br />
base.OnFormClosing(e);<br />
}
I want that splitter remain in this place when form is opened again.
It is not possible to add fixed place constant to code.
Andrus
|
|
|
|
|
This is allready built in...
Splitcontainer.FixedPanel
|
|
|
|
|
Hi,
I want to know how to add,update the data from a datagridview(Windows Application)
here user will be entering the data in the grid view itself
thank you
*** Why EXPERTS behave like a fool ***
|
|
|
|
|
I guess you should change your screen name since you are obviously not a Dot_Net Dude.
Here is the answer to your question. I found it in 2 seconds with a Google search.
An expert is not someone who knows everything. An expert is someone that knows where to ask.
Tutorial on Disconnected Datasets[^]
|
|
|
|
|
i m using the numeric validation for mobile...
if (txt_mob.Text != "")
{
Regex n = new Regex(@"(?<name>[0-9]|- |\+){10,20}");
Match v = n.Match(txt_mob.Text);
if (!v.Success || txt_mob.Text.Length > 20 || txt_mob.Text.Length < 10)
{
MessageBox.Show("Only digits '+' & '-' are allowed in Mobile and its size should be between 10 and 20 characters");
txt_mob.Focus();
}
}
its working ..but it takes 10 characters numeric and after that it is also accepting non-numeric characters please help
|
|
|
|
|
damn... why dont you use KeyPress event and check e.KeyChar, if its numeric then go ahead else show message, something like this
if (char.IsNumeric(e.KeyChar))
{
}
else
{
}
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-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
i dont want to bind a user on key-press..but want to display an error message that (s)he should enter the numeric on mobile...please help that how should i improve this expression
|
|
|
|
|
Neetu Maheshwari wrote: (?<name>[0-9]|- |\+){10,20}
Looks like you need assert position at the start and end. Try this
^(?<name>[0-9]|- |\+){10,20}$
|
|
|
|
|
Regex n = new Regex(@"^(?[0-9]|- |\+){10,20}$");...throwing this error..parsing "^(?[0-9]|- |\+){10,20}$" - Unrecognized grouping construct...please help
|
|
|
|
|
Make sure your string is well-formed. It's working at my end.
|
|
|
|
|
thank you very much..its working
|
|
|
|
|
An alternative method would be to try and use Double.TryParse , or Int32.TryParse . Something like that. If they fail to conevrt the string into a number then you have non-numeric characters in the text box.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|