|
|
So
your code may have incorrect way.
please check your code is correct.
i think u must add cellcolumn.instead of assign to cell.
because of we want to add our cell column control to datagridview control collections.
|
|
|
|
|
Hello all. I'm trying to allow a user to save a text file and only a text file. My filter is "Text files (*txt)|*txt" This seems to be set up fine but when I save a file, I can save as .doc. This shouldn't happen, at least that's what I thought.
Where am I going wrong?
Lester
http://www.lestersconyers.com
|
|
|
|
|
You're making the assumption that the SaveAs dialog restricts the extension the user can use. Wrong. This only filter the filenames listed in the dialog box. You're code has to make sure the extension is correct, and fix it if it's not, after the user clicks OK and before you open the stream to start writing your data.
|
|
|
|
|
I have used WndProc() override to perform PostMessage(this.listViewEx2.Handle, WM_VSCROLL, e.WParam, IntPtr.Zero);
I managed to bring it to some shape now but came up with some amazingly annoying issues!
In all my issues here are as follows
1. scroll works only by thumb tack
2. mouse scroll doesnt trigger listview2
3. scrolling using the bar and not the thumb tack doesnt scroll the listview2
4. how do i prevent the two events from going into an infinite loop when i paste the code for ListView2_Scroll?
Hoping for an express response!
-
Roger
|
|
|
|
|
Perhaps if you specify what you're trying to do, we can provide you with an alternate, managed way to do it.
|
|
|
|
|
private void listViewEx1_Scroll(object Sender, LifeHouse.ListViewEx.ListViewEx.MyScrollEventArgs e)<br />
{<br />
try<br />
{<br />
Int16 hi = (Int16)((int)e.WParam >> 16);<br />
Int16 lo = (Int16)(int)e.WParam;<br />
IntPtr temp;<br />
if (e.Orientation == ScrollOrientation.VerticalScroll)<br />
{<br />
if (lo == 5)<br />
{<br />
if (SetScrollPos(this.listViewEx2.Handle, SBS_VERT, hi, true) != 0)<br />
{<br />
temp = (IntPtr)(4 + 0x10000 * hi);<br />
PostMessage(this.listViewEx2.Handle, WM_VSCROLL, temp, IntPtr.Zero);<br />
}<br />
}<br />
else<br />
{<br />
PostMessage(this.listViewEx2.Handle, WM_VSCROLL, e.WParam, IntPtr.Zero);<br />
}<br />
}<br />
<br />
if (e.Orientation == ScrollOrientation.HorizontalScroll)<br />
{<br />
if (lo == 5)<br />
{<br />
SetScrollPos(this.listViewEx2.Handle, SBS_HORZ, hi, true);<br />
PostMessage(this.listViewEx2.Handle, WM_HSCROLL, (IntPtr)(4 + 0x10000 * hi), IntPtr.Zero);<br />
}<br />
else<br />
{<br />
PostMessage(this.listViewEx2.Handle, WM_HSCROLL, e.WParam, IntPtr.Zero);<br />
}<br />
}<br />
}<br />
<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.ToString());<br />
}<br />
}
This is my code that is supposed to scroll ListViewEx2 when ListViewEx1 is clicked. I am able to achieve a scroll with the thumbtrack of ListViewEx1 but when i hold and drag the scrollbar there is no change in ListViewEx2's scroll in contents (that is, only the scroll bar moves while the content staying put).
Mouse's wat scroll event could trigger a similar scroll?
How to get both scrolls to sync?
|
|
|
|
|
|
If you want to sync the scrolling of two lists, here might be the right way to get it:
- for each item in the master list, identify the corresponding item in the slave list,
and add a (masterItem, slaveItem) to a Hashtable/Dictionary;
- whenever the master list scrolls, determine the new top master item, look up the
corresponding slave item, and scroll the slave list using ListView.TopItem,
ListBox.TopIndex or a similar property.
When the master list does not offer a scrollChanged event, use a Windows.Forms.Timer to do
the above periodically.
That should be much simpler than manipulating Windows messages, WndProc and the like.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
That's the first way that i went by but that aint what the project requires!
When the user clicks on the scrollbar and scrolls the other listview has to be in sync. that is behave as though the user is clicking on two listviews at once and scrolling.
That is the reason i've been trying to override WndProc()!
Can anyone figure a way?
|
|
|
|
|
can you help me guyz.How to make outset of our software through visual studio while setup deployment.I mean how change the default settings,such as showing color progressbar instead of regular one..like that.
i hope you'll get me
|
|
|
|
|
I don't believe that's possible using the standard Visual Studio setup projects. You'll need a more powerful tool to do this, such as InstallShield.
|
|
|
|
|
I have been googling for an answer on this and I just can't find it.
I have a groupbox that contains several checkboxes.
When I go through a foreach loop, the order in the groupbox.controls seems to have no order, but are in the same order everytime.
foreach(CheckBox s in grpGroup.Controls)<br />
{<br />
if(s.Checked)<br />
{<br />
blReports[intx] = true;<br />
}<br />
intx++;<br />
}<br />
What is the logical order of the groupbox.controls collection? It is not tab order, nor creation order. I just can't figure this out.
Thanx in advance!
Jude
|
|
|
|
|
This is the order in which items are inserted in the Controls collection of group box.
Only point is that you get controls in reverse order, which means if you have controls ctrl1, ctrl2 and ctrl3 added.
You will get ctrl3, ctrl2 and ctrl1 using 'for each' loop.
-Ajay.
-------------------------
www.componentone.com
-------------------------
|
|
|
|
|
Ajay K. Singh wrote: This is the order in which items are inserted in the Controls collection of group box.
My question is what controls the order in which the items are inserted into the Controls collection.
The creation order in the code is cntl1,cntl2,cntl3,cntl4,cntl5,cntl6,cntl7.
The order of the foreach loop is 7,2,4,5,1,3,6.
Thanx for the reply!
Jude
|
|
|
|
|
Hi,
AFAIK the order of the controls is not the declaration order, not the creation order, it is
the order in which they get added to their parents Controls collection, which depends
a lot on your Designer interaction. You can modify the order by (carefully) editing
the designer-generated file (xxx.designer.cs). You can also set a new order by:
-first removing all the controls (i.e. move them from the groupbox to the form itself);
-then add them again, one by one, in the desired order (i.e. move them back from the form
to the groupbox).
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
If you want to have a more logical order that you have more control of:
for(int i=0;i<grpgroup.controls.count;i++)>
{
Checkbox s=(CheckBox)grpGroup.Controls(i);
if(s.Checked)
{
blReports[intx] = true;
}
intx++;
}
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[^]
|
|
|
|
|
Thanx for all of the replies! From what I gather it is VS dependent in which order controls are added to the groupbox.controls collection.
I decided to go with a switch based on the control name:
if(s.Checked)<br />
{<br />
switch(s.Name)<br />
{<br />
case "cboDepr":<br />
blReports[0] = true;<br />
break;...
Not very elegant, but gets the job done.
Thanx again!
Jude
|
|
|
|
|
Hi
you can check in mm.designer.cs file for the answer, there one array have ur control sequence.
|
|
|
|
|
Is that some type of 2005 or + thing? I am still using VS2003..I don't program any big projects in VS and have kept the staple w/ .net 1.1.
I got it working with my non-elegant code
Thanx for the reply!
And thank you to all who have replied to this thread for not being an ass!
Jude
|
|
|
|
|
Hey I am trying to use System.Threading.Thread.Sleep() and I am not getting expected results.
I am trying to use it as a delay
turn RTS on<br />
System.Threading.Thread.Sleep(5);<br />
turn RTS off
I have an o-scope hooked to the RTS line and I would expect that the RTS should go on and off anytime over 5 milliseconds (due to windows timing issues), but I would not expect to see it take anytime less than 5 milliseconds.
However, I am seeing results anywhere from just under 1 millisecond up to 20 milliseconds. Again if it was just 4 milliseconds (because of the resolution, i thought maybe we could see something as long as it was greater than 4) to whatever, I would be fine with that, but it is returning in less than 4 milliseconds down to one millisecond even!
Just for giggles I set up this
<br />
Using System.Diagnostics;<br />
Using System.Threading;<br />
<br />
long startTime,finishTime,diff;<br />
float elapsed;<br />
<br />
for (int x = 1; x <=10 ; x++)<br />
{<br />
startTime = Stopwatch.GetTimeStamp();<br />
Thread.Sleep(x);<br />
finishTime = Stopwatch.GetTimeStamp();<br />
diff = finishTime - startTime; <br />
elapsed = diff / 10000; <br />
Console.Write(x + " > " + elapsed + "ms > " + diff);<br />
}
And am seeing very similar (and stragne) results.
Is this just a bug in the the sleep function or what? Is there another function that I can call instead? (Don't even think about writing that I should be polling---don't get me started--, I am working in an environment where milliseconds difference are noticable, polling would be such a time killer)
Thanks
Brandy
|
|
|
|
|
aei_totten wrote: Is this just a bug in the the sleep function or what?
I don't believe so. I believe it is documented to have inconsistent results for anything less that 55 mills. Granted I haven't looked at it for many years but I think that's what it said at one time. I also believe that are higher resolution timers[^] you should use for the type of requirements you have.
led mike
|
|
|
|
|
|
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Windows is not a real-time O/S. The resolution of those timers is not guaranteed and can vary from system to system, and even vary due to system load.
If you want to grab analog/digital data at a consistance rate, you'd have to use hardware dedicated to the task. This would be something like an Analog/Digital converter board or some other PCI/PCIx data acquisition board that comes with an API to do the data capture/buffering independant of the system CPU.
|
|
|
|
|