473,735 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

easy grid editing ? ? ? (equivalent to msflexgrid)

can someone explain how to simply populate a grid in .net ? the way i
understand it, there is no more msflexgrid, and instead is this new
control that has to be tied to a dataset, and it is a real pain to
work with if you just want to throw some values in a grid and edit
them with a textbox. i don't want to persist anything in a database, i
just need a fast cheap and easy grid in memory that i can work with!

i had functions in vb6 that would insert (tab & vbcrlf) delimited text
into a grid, and vice versa. it was super easy. if you clicked on the
grid, it would superimpose a textbox you could type in, and on lost
focus, the textbox contents got copied into the appropriate cell.

is there some existing code to do this in vb.net easily?
(i stress EASILY! it's 2004, this kinda stuff is supposed to get
easier as technology advances is it not!)

many thanks

-----

vb6 code i want to find equivalent to:

'this function converts tab/vbcrlf delim text to a msflexgrid
Function fn_sCopyGridToT ext(ByRef grdTemp As Object, ByVal iFirstRow
As Integer, ByVal iFirstCol As Integer) As String

'this function converts contents of msflexgrid to delim (eg
tab/vbcrlf) text
Sub subCopyTextToGr id(ByRef sString As String, ByRef grdTemp As
Object, ByVal iFirstRow As Integer, ByVal iFirstCol As Integer, ByVal
sRowDelim As String, ByVal sColDelim As String, ByVal bClearGrid As
Boolean)

'when user clicks msflexgrid, puts a textbox over the cell they
clicked on so they can edit text in cell
Private Sub grdValues_Click ()
Dim sGridDisplay As String

' SAVE POSITION
g_dictValues.It em("iGridRow") = grdValues.Row
g_dictValues.It em("iGridCol") = grdValues.Col

' GET VALUE
sGridDisplay = fn_No_Empty(grd Values.TextMatr ix(grdValues.Ro w,
grdValues.Col), "", True) ' get value in grid

' BUILD TEXT BOX, PLACE OVER CURRENT CELL
txtEdit.Text = sGridDisplay ' copy text of current cell into edit
box
txtEdit.Top = grdValues.Top + grdValues.CellT op
txtEdit.Left = grdValues.Left + grdValues.CellL eft
txtEdit.Width = grdValues.CellW idth
txtEdit.Height = grdValues.CellH eight
txtEdit.Text = grdValues.Text
g_dictValues.It em("sOriginalTe xt") = grdValues.Text
txtEdit.Visible = True
txtEdit.SetFocu s

End Sub ' grdValues_Click

'when user exits textbox, save contents in grid
Private Sub txtEdit_LostFoc us()

' =============== =============== =============== =============== =======
' SAVE TEXT IN GRID
grdValues.TextM atrix(g_dictVal ues.Item("iGrid Row"),
g_dictValues.It em("iGridCol") ) = txtEdit.Text
'grdValues.Text Matrix(g_iGridR ow, g_iGridCol)
txtEdit.Visible = False

End Sub ' txtEdit_LostFoc us
Nov 20 '05 #1
1 4972
Hi Mad,

The answer on your question is very simple.

The only thing you have to know is that using a datagrid is as well using a
table where the datatable is the most easy one for that.

To show you how easy I type it in here beneath without checking so watch
typos, I assume you have pulled a datagrid1 on your form

I hope this helps?

Cor

\\\
dim dt as new datatable
dt.columns.add( "Mad")
dt.columns.add( "Cor")
for i as integer = 0 to 9
dim dr as datarow = dt.newrow
dr(i)(0)= i.tostring
dr(i)(1)= chr(i + 64)
dt.rows.add(dr)
next
datagrid1.datas ource = dt
///
can someone explain how to simply populate a grid in .net ? the way i
understand it, there is no more msflexgrid, and instead is this new
control that has to be tied to a dataset, and it is a real pain to
work with if you just want to throw some values in a grid and edit
them with a textbox. i don't want to persist anything in a database, i
just need a fast cheap and easy grid in memory that i can work with!

i had functions in vb6 that would insert (tab & vbcrlf) delimited text
into a grid, and vice versa. it was super easy. if you clicked on the
grid, it would superimpose a textbox you could type in, and on lost
focus, the textbox contents got copied into the appropriate cell.

is there some existing code to do this in vb.net easily?
(i stress EASILY! it's 2004, this kinda stuff is supposed to get
easier as technology advances is it not!)

many thanks

-----

vb6 code i want to find equivalent to:

'this function converts tab/vbcrlf delim text to a msflexgrid
Function fn_sCopyGridToT ext(ByRef grdTemp As Object, ByVal iFirstRow
As Integer, ByVal iFirstCol As Integer) As String

'this function converts contents of msflexgrid to delim (eg
tab/vbcrlf) text
Sub subCopyTextToGr id(ByRef sString As String, ByRef grdTemp As
Object, ByVal iFirstRow As Integer, ByVal iFirstCol As Integer, ByVal
sRowDelim As String, ByVal sColDelim As String, ByVal bClearGrid As
Boolean)

'when user clicks msflexgrid, puts a textbox over the cell they
clicked on so they can edit text in cell
Private Sub grdValues_Click ()
Dim sGridDisplay As String

' SAVE POSITION
g_dictValues.It em("iGridRow") = grdValues.Row
g_dictValues.It em("iGridCol") = grdValues.Col

' GET VALUE
sGridDisplay = fn_No_Empty(grd Values.TextMatr ix(grdValues.Ro w,
grdValues.Col), "", True) ' get value in grid

' BUILD TEXT BOX, PLACE OVER CURRENT CELL
txtEdit.Text = sGridDisplay ' copy text of current cell into edit
box
txtEdit.Top = grdValues.Top + grdValues.CellT op
txtEdit.Left = grdValues.Left + grdValues.CellL eft
txtEdit.Width = grdValues.CellW idth
txtEdit.Height = grdValues.CellH eight
txtEdit.Text = grdValues.Text
g_dictValues.It em("sOriginalTe xt") = grdValues.Text
txtEdit.Visible = True
txtEdit.SetFocu s

End Sub ' grdValues_Click

'when user exits textbox, save contents in grid
Private Sub txtEdit_LostFoc us()

' =============== =============== =============== =============== =======
' SAVE TEXT IN GRID
grdValues.TextM atrix(g_dictVal ues.Item("iGrid Row"),
g_dictValues.It em("iGridCol") ) = txtEdit.Text
'grdValues.Text Matrix(g_iGridR ow, g_iGridCol)
txtEdit.Visible = False

End Sub ' txtEdit_LostFoc us

Nov 20 '05 #2

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

Similar topics

1
4944
by: Bhom | last post by:
I am trying to create a grid on a form that looks like the 'Split Transaction' grid in Quicken - it allows drop down controls in various cells of grid to make a selection, and then stores the text of the drop down list/combo boxes in the grid. I know how to use hidden combo/list boxes that display when a user clicks on a cell that is setup with the drop down button and event. However, when the user makes a selection, the ID (bound...
2
2446
by: build | last post by:
G'day all, I want to load comma sep text files and display it in a grid. I'd like something simple and lightweight. Don't need to edit it in grid, I could do that in textboxes if required. tia build
1
740
by: Mad Scientist Jr | last post by:
can someone explain how to simply populate a grid in .net ? the way i understand it, there is no more msflexgrid, and instead is this new control that has to be tied to a dataset, and it is a real pain to work with if you just want to throw some values in a grid and edit them with a textbox. i don't want to persist anything in a database, i just need a fast cheap and easy grid in memory that i can work with! i had functions in vb6 that...
4
2014
by: Stanley Sin | last post by:
Dear all , Could anyone suggest some good 3rd party grid control of visual basic.net 2005? Any free? Thanks in advance. BR,
0
1648
by: Steven | last post by:
Hi All, Is there any method to copy the MSFlexGrid data (including the text color, cell background color etc) to the microsoft excel work sheet? By using the clipboard function, I can read the text cell by cell, however, I don't have any idea to copy the text color and cell background color as well. Any one can help me? Thanks! Steven.
0
1437
by: vaavachi | last post by:
Hi, I would like to allow users to select from a drop down list for all cells in, let say, column 3. How can I add a combo box to that column? I read something about a "button" property of a column, but I can't find the property. Is there any "button" property in MSFlexGrid? How to use it? Some people said that a combo box has to bind to a field of the grid...
3
12011
by: Andrus | last post by:
In VCSE 2008 B2 I created WPF form, added grid an ran it. Form does not show grid. Where to find sample which allows to edit object collection returned by Linq-SQL in WPF grid ? Andrus.
4
1911
by: Gilles Ganault | last post by:
Hello For business apps, we need a good, solid, bound- and unbound grid widget. In VB Classic apps, we use ComponentOne's VSFlexGrid widget www.componentone.com I was wondering if there are equivalent widgets for PHP apps, or we should rather look at what's available in the ASP.Net world. If you have worked with both environments, what would you recommend
2
7880
by: MiziaQ | last post by:
Hey, how can I allow the user to edit ANY cell from any row and column in an msflexgrid ? I found the following code, but it only allows input for the first column. Thank you in advance. Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer) Dim sTemp As String With MSFlexGrid1 sTemp = .TextMatrix(.row, .Col)
0
8964
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8786
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9466
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9327
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9253
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8202
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3277
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 we have to send another system
3
2190
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.