473,503 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Grid Scroll Bar

Hi

Is there a way to force a vertical scroll bar on the data grid, even if the
data grid has no rows?

Thanks

Regards
Nov 20 '05 #1
11 5173
in vb.nei created a timer control in design time, and its
default properties were interval = 3000, enabled = false

when u click on a button it enables the timer and that
works fine, but on another form when they press
the "okay" button it should set the interval to the ,
user specification, but it remains the same as the
default one set in desing time, it changes if its on the
same form perfectly, but not if that command is called
from another form. (in a midule i made the form
declaration as so "public cmain as new main"
then to change the interval it was this
cmain.timer.interval = txt.text

thx
Nov 20 '05 #2
No.

OHM
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi

Is there a way to force a vertical scroll bar on the data grid, even if the data grid has no rows?

Thanks

Regards

Nov 20 '05 #3
Hello,

"Andrew" <ve**********@hotmail.com> schrieb:
in vb.nei created a timer control in design time, and its
default properties were interval = 3000, enabled = false

when u click on a button it enables the timer and that
works fine, but on another form when they press
the "okay" button it should set the interval to the ,
user specification, but it remains the same as the
default one set in desing time, it changes if its on the
same form perfectly, but not if that command is called
from another form. (in a midule i made the form
declaration as so "public cmain as new main"
then to change the interval it was this
cmain.timer.interval = txt.text


I think the problem is that you create a _new_ instance of the form in the
module and change the 'Interval' property of its timer control. You can add
a parameter to your procedure and pass the reference to your instance of the
form:

\\\
Public Module Moo
Public Sub Foo(ByVal Goo As Form1)
Goo.Timer1.Interval = 100
End Sub
End Module
///

In the form:

\\\
Moo.Foo(Me)
///

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #4
Yes, but as far as I know you need to do it all yourself. So if you plan on
reusing this sometime you can always just derive from the DataGrid and wire
in the logic yourself. You may need to make a few modifications to the code
below, but this should get you started.

public class MyDataGrid : System.Windows.Forms.DataGrid
{
public MyDataGrid ()
{
this.VertScrollBar.Visible = true;
this.VertScrollBar.VisibleChanged += new
EventHandler(VertScrollBar_VisibleChanged);
}

private void VertScrollBar_VisibleChanged(object sender, EventArgs e)
{
this.VertScrollBar.Visible = true;
}

protected override void OnResize(System.EventArgs e)
{
// TODO: Need to take caption height and some other aspects into
consideration.
this.VertScrollBar.Bounds = new Rectangle(this.ClientRectangle.Width -
this.VertScrollBar.Width, 0, this.VertScrollBar.Width,
this.ClientRectangle.Height);
base.OnResize(e);
}
}

--
Tim Wilson
Windows Embedded MVP
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi

Is there a way to force a vertical scroll bar on the data grid, even if the data grid has no rows?

Thanks

Regards

Nov 20 '05 #5
I stand corrected then. Was this tested on Cx or VB.NET ?

Regards - OHM

"Tim Wilson [MVP]" <Ti********@Rogers.com> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...
Yes, but as far as I know you need to do it all yourself. So if you plan on reusing this sometime you can always just derive from the DataGrid and wire in the logic yourself. You may need to make a few modifications to the code below, but this should get you started.

public class MyDataGrid : System.Windows.Forms.DataGrid
{
public MyDataGrid ()
{
this.VertScrollBar.Visible = true;
this.VertScrollBar.VisibleChanged += new
EventHandler(VertScrollBar_VisibleChanged);
}

private void VertScrollBar_VisibleChanged(object sender, EventArgs e)
{
this.VertScrollBar.Visible = true;
}

protected override void OnResize(System.EventArgs e)
{
// TODO: Need to take caption height and some other aspects into
consideration.
this.VertScrollBar.Bounds = new Rectangle(this.ClientRectangle.Width -
this.VertScrollBar.Width, 0, this.VertScrollBar.Width,
this.ClientRectangle.Height);
base.OnResize(e);
}
}

--
Tim Wilson
Windows Embedded MVP
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi

Is there a way to force a vertical scroll bar on the data grid, even if

the
data grid has no rows?

Thanks

Regards


Nov 20 '05 #6
This is C#, but shouldn't matter. I fully expect that this would run in a
VB.Net application (if translated, of course). And this could also be
written as a control in C# and then used in a VB.Net app - it's the beauty
of IL code.

--
Tim Wilson
Windows Embedded MVP

"One Handed Man [ OHM ]" <te***************************@BTOpenworld.com>
wrote in message news:OO****************@TK2MSFTNGP12.phx.gbl...
I stand corrected then. Was this tested on Cx or VB.NET ?

Regards - OHM

"Tim Wilson [MVP]" <Ti********@Rogers.com> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...
Yes, but as far as I know you need to do it all yourself. So if you plan

on
reusing this sometime you can always just derive from the DataGrid and

wire
in the logic yourself. You may need to make a few modifications to the

code
below, but this should get you started.

public class MyDataGrid : System.Windows.Forms.DataGrid
{
public MyDataGrid ()
{
this.VertScrollBar.Visible = true;
this.VertScrollBar.VisibleChanged += new
EventHandler(VertScrollBar_VisibleChanged);
}

private void VertScrollBar_VisibleChanged(object sender, EventArgs e)
{
this.VertScrollBar.Visible = true;
}

protected override void OnResize(System.EventArgs e)
{
// TODO: Need to take caption height and some other aspects into
consideration.
this.VertScrollBar.Bounds = new Rectangle(this.ClientRectangle.Width - this.VertScrollBar.Width, 0, this.VertScrollBar.Width,
this.ClientRectangle.Height);
base.OnResize(e);
}
}

--
Tim Wilson
Windows Embedded MVP
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi

Is there a way to force a vertical scroll bar on the data grid, even
if the
data grid has no rows?

Thanks

Regards



Nov 20 '05 #7
This is a vb group and I am getting c# examples. :( as if vb.net wasn't
difficult enough.

Regards
"Tim Wilson [MVP]" <Ti********@Rogers.com> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...
Yes, but as far as I know you need to do it all yourself. So if you plan on reusing this sometime you can always just derive from the DataGrid and wire in the logic yourself. You may need to make a few modifications to the code below, but this should get you started.

public class MyDataGrid : System.Windows.Forms.DataGrid
{
public MyDataGrid ()
{
this.VertScrollBar.Visible = true;
this.VertScrollBar.VisibleChanged += new
EventHandler(VertScrollBar_VisibleChanged);
}

private void VertScrollBar_VisibleChanged(object sender, EventArgs e)
{
this.VertScrollBar.Visible = true;
}

protected override void OnResize(System.EventArgs e)
{
// TODO: Need to take caption height and some other aspects into
consideration.
this.VertScrollBar.Bounds = new Rectangle(this.ClientRectangle.Width -
this.VertScrollBar.Width, 0, this.VertScrollBar.Width,
this.ClientRectangle.Height);
base.OnResize(e);
}
}

--
Tim Wilson
Windows Embedded MVP
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi

Is there a way to force a vertical scroll bar on the data grid, even if

the
data grid has no rows?

Thanks

Regards


Nov 20 '05 #8
Yes this example is in C#. But you posted your question to a whole bunch of
newsgroups and I am responding from the
microsoft.public.dotnet.framework.windowsforms.con trols newsgroup. So there
is no language specification here. There are many C# to VB.Net converters
out there. Here is one:
http://www.aspalliance.com/aldotnet/...translate.aspx

--
Tim Wilson
Windows Embedded MVP

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:Od**************@TK2MSFTNGP11.phx.gbl...
This is a vb group and I am getting c# examples. :( as if vb.net wasn't
difficult enough.

Regards
"Tim Wilson [MVP]" <Ti********@Rogers.com> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...
Yes, but as far as I know you need to do it all yourself. So if you plan

on
reusing this sometime you can always just derive from the DataGrid and

wire
in the logic yourself. You may need to make a few modifications to the

code
below, but this should get you started.

public class MyDataGrid : System.Windows.Forms.DataGrid
{
public MyDataGrid ()
{
this.VertScrollBar.Visible = true;
this.VertScrollBar.VisibleChanged += new
EventHandler(VertScrollBar_VisibleChanged);
}

private void VertScrollBar_VisibleChanged(object sender, EventArgs e)
{
this.VertScrollBar.Visible = true;
}

protected override void OnResize(System.EventArgs e)
{
// TODO: Need to take caption height and some other aspects into
consideration.
this.VertScrollBar.Bounds = new Rectangle(this.ClientRectangle.Width - this.VertScrollBar.Width, 0, this.VertScrollBar.Width,
this.ClientRectangle.Height);
base.OnResize(e);
}
}

--
Tim Wilson
Windows Embedded MVP
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi

Is there a way to force a vertical scroll bar on the data grid, even
if the
data grid has no rows?

Thanks

Regards



Nov 20 '05 #9
Impressive. I used the converter and tried out your code. It works very
well.

"Tim Wilson [MVP]" <Ti********@Rogers.com> wrote in message
news:ON**************@TK2MSFTNGP11.phx.gbl...
Yes this example is in C#. But you posted your question to a whole bunch of newsgroups and I am responding from the
microsoft.public.dotnet.framework.windowsforms.con trols newsgroup. So there is no language specification here. There are many C# to VB.Net converters
out there. Here is one:
http://www.aspalliance.com/aldotnet/...translate.aspx

--
Tim Wilson
Windows Embedded MVP

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:Od**************@TK2MSFTNGP11.phx.gbl...
This is a vb group and I am getting c# examples. :( as if vb.net wasn't
difficult enough.

Regards
"Tim Wilson [MVP]" <Ti********@Rogers.com> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...
Yes, but as far as I know you need to do it all yourself. So if you plan
on
reusing this sometime you can always just derive from the DataGrid and

wire
in the logic yourself. You may need to make a few modifications to the

code
below, but this should get you started.

public class MyDataGrid : System.Windows.Forms.DataGrid
{
public MyDataGrid ()
{
this.VertScrollBar.Visible = true;
this.VertScrollBar.VisibleChanged += new
EventHandler(VertScrollBar_VisibleChanged);
}

private void VertScrollBar_VisibleChanged(object sender, EventArgs
e) {
this.VertScrollBar.Visible = true;
}

protected override void OnResize(System.EventArgs e)
{
// TODO: Need to take caption height and some other aspects into
consideration.
this.VertScrollBar.Bounds = new

Rectangle(this.ClientRectangle.Width - this.VertScrollBar.Width, 0, this.VertScrollBar.Width,
this.ClientRectangle.Height);
base.OnResize(e);
}
}

--
Tim Wilson
Windows Embedded MVP
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> Hi
>
> Is there a way to force a vertical scroll bar on the data grid, even if the
> data grid has no rows?
>
> Thanks
>
> Regards
>
>



Nov 20 '05 #10
Why not post the vb code here?

Thanks

Regards

"One Handed Man [ OHM ]" <te***************************@BTOpenworld.com>
wrote in message news:uB**************@TK2MSFTNGP09.phx.gbl...
Impressive. I used the converter and tried out your code. It works very
well.

"Tim Wilson [MVP]" <Ti********@Rogers.com> wrote in message
news:ON**************@TK2MSFTNGP11.phx.gbl...
Yes this example is in C#. But you posted your question to a whole bunch

of
newsgroups and I am responding from the
microsoft.public.dotnet.framework.windowsforms.con trols newsgroup. So

there
is no language specification here. There are many C# to VB.Net converters
out there. Here is one:
http://www.aspalliance.com/aldotnet/...translate.aspx

--
Tim Wilson
Windows Embedded MVP

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:Od**************@TK2MSFTNGP11.phx.gbl...
This is a vb group and I am getting c# examples. :( as if vb.net wasn't difficult enough.

Regards
"Tim Wilson [MVP]" <Ti********@Rogers.com> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...
> Yes, but as far as I know you need to do it all yourself. So if you plan on
> reusing this sometime you can always just derive from the DataGrid and wire
> in the logic yourself. You may need to make a few modifications to the code
> below, but this should get you started.
>
> public class MyDataGrid : System.Windows.Forms.DataGrid
> {
> public MyDataGrid ()
> {
> this.VertScrollBar.Visible = true;
> this.VertScrollBar.VisibleChanged += new
> EventHandler(VertScrollBar_VisibleChanged);
> }
>
> private void VertScrollBar_VisibleChanged(object sender, EventArgs e) > {
> this.VertScrollBar.Visible = true;
> }
>
> protected override void OnResize(System.EventArgs e)
> {
> // TODO: Need to take caption height and some other aspects into
> consideration.
> this.VertScrollBar.Bounds = new

Rectangle(this.ClientRectangle.Width -
> this.VertScrollBar.Width, 0, this.VertScrollBar.Width,
> this.ClientRectangle.Height);
> base.OnResize(e);
> }
> }
>
> --
> Tim Wilson
> Windows Embedded MVP
> "John" <jo**@nospam.infovis.co.uk> wrote in message
> news:%2****************@TK2MSFTNGP12.phx.gbl...
> > Hi
> >
> > Is there a way to force a vertical scroll bar on the data grid,

even if
> the
> > data grid has no rows?
> >
> > Thanks
> >
> > Regards
> >
> >
>
>



Nov 20 '05 #11
Instantiate this at Form class level and remember to add it to the
form.controls collection

me.controls.add( InstantiatedGrid )
Public Class MyDataGrid
Inherits System.Windows.Forms.DataGrid

Public Sub New()
Me.VertScrollBar.Visible = True
AddHandler Me.VertScrollBar.VisibleChanged, AddressOf
VertScrollBar_VisibleChanged
End Sub 'New
Private Sub VertScrollBar_VisibleChanged(sender As Object, e As
EventArgs)
Me.VertScrollBar.Visible = True
End Sub 'VertScrollBar_VisibleChanged
Protected Overrides Sub OnResize(e As System.EventArgs)
' TODO: Need to take caption height and some other aspects into
consideration.__unknown
Me.VertScrollBar.Bounds = New Rectangle(Me.ClientRectangle.Width -
Me.VertScrollBar.Width, 0, Me.VertScrollBar.Width,
Me.ClientRectangle.Height) '
'ToDo: Error processing original source shown below
'
'
'-----^--- Syntax error: 'identifier' expected
MyBase.OnResize(e)
End Sub 'OnResize
End Class 'MyDataGrid
"
Nov 20 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3259
by: blackhawk | last post by:
I need to build a web page that has to potentially display a large amount of data in two grids on the same page. The HTML file with all of the formatting is about 7MB in size. This is too large...
3
2192
by: pmud | last post by:
Hi, I have a web page (asp.net, code:c#). I havean html table with text boxes. Based on the user input , records are displayed in the data grid below it. Now the datagrid has a large no. of...
1
2129
by: Joe Dunleavy | last post by:
Hi Guys, Hopefully some one will have come across this issue already. I have a DataGrid inside a Div where a scroll bar displays once a certain height is meet --> <div id="dvSales"...
10
1913
by: John Wilson | last post by:
My app produces some long datatables to display in a grid. So I put them in a div so users can scroll. But the grid headers scroll out of view. I would like to stop them doing this. Can I fix them...
6
1974
by: Tom | last post by:
I need to make up a 'grid' of controls at run time. The controls (of which I wrote) I will instantiate, then I need to arrange these in a row/column layout. For example, let's say I instantiate 20...
1
3550
by: Robert G | last post by:
I'm using VB .net 2003. I have a grid where everything is working fine except when after the grid is filled with records (by setting the data source to a data view), both the horizontal and...
3
5027
by: EdB | last post by:
How do I capture the position of the vertical scroll bar? I present the grid to a user, they select an item, and I pop up an edit window. When they are done, I need to refresh the grid (editing...
0
1025
by: Devesh | last post by:
Hi, I want to display some parameters & their value in Same data grid as shown Parameter | Value | Parameter | Value |Parameter | Value So please suggest me the way to Split...
2
3837
by: Umeshnath | last post by:
Hi, I have placed a grid view inside Atlas panel. On click of a button event, data is populated in the grid view, I want to add scroll bar instead of increasing the size of grid view. I have...
3
2459
by: gaya3 | last post by:
Hi All, I have painted the dojo grid 1.1 with height of 20em as follows.. # gridName { height:20em; } The input for that grid is about 1000 records.so, number of...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.