473,395 Members | 1,668 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.

MSFLEXGRID problem

Hi...

Below is my code:

Expand|Select|Wrap|Line Numbers
  1. Dim trs As New ADODB.Recordset
  2. Public cn As ADODB.Connection
  3.  
  4.  
  5. Public Sub databaseconnect()
  6. Set cn = New ADODB.Connection
  7. cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=hrms;Data Source=."
  8. End Sub
  9.  
  10.  
  11. Private Sub Combo1_Click()   ' pcode
  12.  
  13. Do While MSFlexGrid1.Rows > 1
  14.  MSFlexGrid1.RemoveItem (MSFlexGrid1.Rows)
  15. Loop
  16.  
  17. If Combo1 <> "" Then
  18. trs.Open "select * from prjmaster where pcode = '" & Combo1 & "'", cn
  19. Label7 = trs.Fields(1)
  20. trs.Close
  21. End If
  22.  
  23. trs.Open "select empid from prjtrans where pcode='" & Combo1 & "'", cn
  24.  
  25. Dim ers  As Recordset
  26.  
  27. Do While Not trs.EOF
  28.  
  29. If trs.RecordCount > 0 Then
  30. ers.Open "select empname from empmaster where empid= " & trs.Fields(0), cn
  31.  
  32.            MSFlexGrid1.AddItem ("")
  33.            MSFlexGrid1.Col = 1
  34.            MSFlexGrid1.Row = MSFlexGrid1.Rows - 1
  35.            MSFlexGrid1.Text = trs.Fields(0)
  36.            MSFlexGrid1.Col = 2
  37.            MSFlexGrid1.Text =ers.Fields(1)
  38.            End If
  39.            trs.MoveNext
  40.            Loop
  41.   trs.Close
  42. End Sub
  43.  
  44. Private Sub Combo2_Click()           'empid
  45. If Combo1 <> "" Then
  46. trs.Open "select * from empmaster where empid = " & Combo2, cn
  47. Label9 = trs.Fields(1)
  48. trs.Close
  49. End If
  50. End Sub
  51.  
  52.  
  53. Private Sub Command1_Click()           'ADD BUTTON
  54. trs.Open "select pcode from prjtrans where pcode = '" + pcode + "'" + "and empid =" + Combo2, cn
  55. cn.Execute "insert into prjtrans values('" & Combo1 & "'," & Combo2 & ",'" & DTPicker1.Value & "','" & DTPicker2.Value & "','" & Combo3.Text & "')"
  56.  
  57.  
  58.             MSFlexGrid1.AddItem ("")
  59.             MSFlexGrid1.Col = 1
  60.             MSFlexGrid1.Row = MSFlexGrid1.Rows - 1
  61.             MSFlexGrid1.Text = Combo2.Text
  62.             MSFlexGrid1.Col = 2
  63.             MSFlexGrid1.Text = Label9
  64.  
  65.             trs.Close
  66.  
  67. End Sub
  68.  
  69.  
  70. Private Sub Form_Load()
  71. Call databaseconnect
  72.  
  73. trs.Open "select * from prjmaster", cn
  74. Do While Not trs.EOF
  75. Combo1.AddItem trs.Fields(0)
  76. trs.MoveNext
  77. Loop
  78. trs.Close
  79.  
  80. trs.Open "select * from empmaster", cn
  81. Do While Not trs.EOF
  82. Combo2.AddItem trs.Fields(0)
  83. trs.MoveNext
  84. Loop
  85. trs.Close
  86.  
  87. Combo3.AddItem "Group Leader"
  88. Combo3.AddItem "Group Member"
  89.  
  90.  
  91.  
  92. MSFlexGrid1.ColWidth(0) = 0
  93. MSFlexGrid1.ColWidth(2) = 1800
  94.  
  95. MSFlexGrid1.Col = 1
  96. MSFlexGrid1.Row = 0
  97. MSFlexGrid1.Text = "Emp ID"
  98.  
  99. MSFlexGrid1.Col = 2
  100. MSFlexGrid1.Row = 0
  101. MSFlexGrid1.Text = "Name"
  102.  
  103. End Sub

My problem is... the values inserted in the prjtrans table... cant get viewable in the flexgrid control while clicking the combo1...
By clicking command1... at tht time...the inserted value gets displayed in the flexgrid...

i cant able to retrieve..from prjtrans...to show in flexgrid while clicking combo1...


Pl...help me...

Sree,
Apr 28 '08 #1
2 1750
debasisdas
8,127 Expert 4TB
Change your sql string to

"select * from prjmaster where pcode = '" & Combo1.list(combo1.listindex) & "'"

also try to execute on Change event of the combo.
Apr 29 '08 #2
Hi..

Thks a lot...

Sree..
Apr 29 '08 #3

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

Similar topics

0
by: Ed | last post by:
Hi, I am using an MSflexgrid in my c# code. I have a strange problem. My MSflexgrid has only 1 column. Now the data in that column can be long. WIth just 1 column the MSflexgrid does not show...
3
by: John Petersen | last post by:
Hi there I really hope someone had this problem before me. I have moved all our c++ projects from VC6 to VS.NET2003 and i have problems with nearly all dialogs containing either DateTimePicker...
1
by: David Sawyer | last post by:
I am attempting to capture data from the serial port, place that data into a MSFlexGrid and then use that data to parse out Lat/Lon to plot to a map. The problem I am having is when I attempt to...
0
by: Martin K | last post by:
Hello all..thanks for everyone's advice regarding my SHBrowseForFolder API problem, I was able to put together a public class that runs great! But I have another migration headache regarding the...
1
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...
1
by: zoneal | last post by:
Hi, I am involved in the process of migrating vb(6.0) application to vb.net. My application contains only vb controls namely MSFLEXGRID. I want to migrate my application to vb.net completely...
5
by: Ishmael | last post by:
Hi Is Been a 3 Yrs Now (I Still trying to do this) Please help me to do this with Visual Basic 6.0 using Msflexgrid Let say you are the Principal . You have 10 educators and 5 class (Grades)...
0
by: godhulirbalaka | last post by:
I have a problem with msflexgrid. I have few field in a form and a msflexgrid with few rows. I want if i double click on the row then the information should go to the relevant field. I have done it...
1
by: godhulirbalaka | last post by:
Dear all, I have a problem with MSFlexGrid. I have few field and one MSFlexGrid So i want if i doubleclick any row then the datas of that row distribute to those field I already wrote the command...
5
by: krafla | last post by:
I have a similar problem with a program i made with VB 6.0 - the only control I used is MSFlexGrid - the program was developed on an XP machine. and the first time to use it on another machine i got...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
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...

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.