473,395 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to do datatable without database

Expand|Select|Wrap|Line Numbers
  1. ' copy this code in a new proyect
  2.  
  3. Public Class Form1
  4.     WithEvents DataGridView1 As DataGridView, PBX As PictureBox
  5.  
  6.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.         Try
  8.             DataGridView1 = New DataGridView
  9.             DataGridView1.Location = New Point(100, 100)
  10.             DataGridView1.Size = New Point(300, 200)
  11.             DataGridView1.Visible = True
  12.             Me.Controls.Add(DataGridView1)
  13.  
  14.             PBX = New PictureBox
  15.             PBX.Location = New Point(420, 100)
  16.             PBX.Size = New Point(200, 200)
  17.             PBX.BorderStyle = BorderStyle.FixedSingle
  18.             PBX.SizeMode = PictureBoxSizeMode.StretchImage
  19.             PBX.Visible = True
  20.             Me.Controls.Add(PBX)
  21.  
  22.             Dim DT(1) As DataTable
  23.  
  24.             DT(1) = New DataTable
  25.             Dim DC As DataColumn
  26.             DC = New DataColumn("Column1", GetType(Object))
  27.  
  28.             DT(1).Columns.Add(DC)
  29.             DC.ColumnName = "A"
  30.  
  31.             DC = New DataColumn("Column2")
  32.             DT(1).Columns.Add(DC)
  33.             DC.ColumnName = "B"
  34.  
  35.             Dim IMG1 As Image = Image.FromFile("C:\MMS FILES\RESOURCES\SCR1.jpg")
  36.             Dim IMG2 As Image = Image.FromFile("C:\MMS FILES\RESOURCES\Perfx.jpg")
  37.  
  38.             DT(1).Rows.Add(IMG1, "222")
  39.             DT(1).Rows.Add(IMG2, "YYY")
  40.  
  41.             DataGridView1.DataSource = DT(1)
  42.  
  43.         Catch ex As Exception
  44.             MsgBox(ex.ToString)
  45.         End Try
  46.  
  47.     End Sub
  48.  
  49.     Private Sub DataGridView2_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.RowEnter
  50.         On Error Resume Next
  51.         PBX.Image = DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value
  52.  
  53.     End Sub
  54.  
  55. End Class
Feb 7 '14 #1
1 1014
Frinavale
9,735 Expert Mod 8TB
What is the problem?
What type of application are you working on?
Feb 12 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Bhavna | last post by:
Hello I want to push the data in my datatable into my database. How must i do this? I have been told to create a insert query. I have done this and have a select statement below it to retrieve the...
4
by: Fabian | last post by:
Hello, i need an example to fill a Dataset Object without a Database. I want to save Strings, like a Database for using it in a Crystal Report. Does anyone have an example for me please ? ...
1
by: Ben | last post by:
Hi All, I am looking for an elegant way to save a datatable to the database. The datatable consists of new rows and rows existing in the database, now i know how to differentiate between the new...
7
by: Susan Mackay | last post by:
I have a data table that is connected to a database table with a data adapter in the 'standard' manner. However I want to be able to remove selected rows from the data table (i.e. no longer...
3
by: weberwhennner | last post by:
Hi All, Ive spent days breaking my head over why the code below doesnt update changes to the database. Could someone please help... OleDbDataAdapter adp = new...
0
by: aboobackerpm | last post by:
i am using a binded dgv with datatable my problem is how i can update the changes in a cell of a dgv to datatable without move to next cell my dgv's allow addnew property is false because of...
1
pod
by: pod | last post by:
Hello Has anyone ever save a datatable to a database new table? If so, could you help me out and show me some sample code? Thanks Perry
4
by: haarigee | last post by:
I need to insert without any parameters and execution query. Since, I have bulk of data's in a dataset the amount of transaction makes the application delay. So i need to directly insert my...
0
by: kumardharanik | last post by:
i need to fill the datatable(datagridview) without using the database.. Here is my code.. But i cant able to fill the datatable [CODE} Public Sub CreateDatatable() dtable = New...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
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
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,...

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.