VB 2005 express...
I created a database "Staff" and it has 1 table in it.
There are 3 columns in it so far.
"StaffID" -INT - Primary Key auto incremented by 1
"FirstName" - Varchar
"LastName" - varchar
( there will be more later - but baby steps )
Then I created 2 forms.
Form1 is the main form where I dragged the datagrid to the form.
Now I made the Datagrid.Select ionMode = FullRowSelect
and the datagrid is not editable.
Now On Form2 I created a property that is going to store the "StaffID"
This form I am going to try to code all "without a wizard".
====
Dim iStaffMember As Integer = ""
Public Property StaffMember() As Integer
Get
Return iStaffMember
End Get
Set(ByVal Value As Integer)
iStaffMember = Value
End Set
End Property
===
So now back on Form1 right before I try to "Form2.SHOW ()" I try to set
that property from the datagrid so i can do my "own select" statement in
form 2 to show the detail's of the data.
( Example like: Select * from Staff where StaffID = StaffMemberProp erty )
But I just cant seem to get the property set correctly
Dim fStaffMember as New Form2
fStaffMember.St affMember =
Me.StaffDataSet .Staff.Rows(Me. StaffDataGridVi ew.CurrentCell. RowIndex)("Staf fID")
first off, the CurrentCell.Row Index is incorrect - since I allow
resorting by column, its actually not the correct index from the dataset.
2nd, I get a convert error.
What is the parameter I should be using to get the "row#" from the bound
dataset?
And what Datatype should by Property be dim'd as?
Thanks
Miro 2 1130
Hi,Miro
"Miro" wrote in message
news:uM******** *****@TK2MSFTNG P06.phx.gbl
Dim iStaffMember As Integer = ""
You can't set String to Integer,so
Dim iStaffMembeer as Integer=-1
Dim fStaffMember as New Form2
fStaffMember.St affMember =
Me.StaffDataSet .Staff.Rows(Me. StaffDataGridVi ew.CurrentCell. RowIndex)("Staf fID")
directcast(Me.S taffDataGridVie w.CurrentRow.Da taBoundItem,
DataRowView).Ro w.Item("StaffID ")
yuichiro ochifuji wrote:
Hi,Miro
"Miro" wrote in message
news:uM******** *****@TK2MSFTNG P06.phx.gbl
>Dim iStaffMember As Integer = ""
You can't set String to Integer,so
Dim iStaffMembeer as Integer=-1
>Dim fStaffMember as New Form2 fStaffMember.S taffMember = Me.StaffDataSe t.Staff.Rows(Me .StaffDataGridV iew.CurrentCell .RowIndex)("Sta ffID")
directcast(Me.S taffDataGridVie w.CurrentRow.Da taBoundItem,
DataRowView).Ro w.Item("StaffID ")
I have just figured this out, just as you posted your post for me,
Dim bmStaff As BindingManagerB ase =
Me.StaffDataGri dView.BindingCo ntext(Me.StaffD ataGridView.Dat aSource,
Me.StaffDataGri dView.DataMembe r)
Dim dr As DataRow = CType(bmStaff.C urrent, DataRowView).Ro w
frmMain.fStaffM ember.StaffMemb er = CInt(dr("StaffI D"))
I tried yours and had to put a CInt( around your directcast.
Im assuming both our codes are doing the same thing?
Thanks,
Miro This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Frnak McKenney |
last post by:
I have a (small) multi-table database application which allows
edits, print reports, and has two scrolling screen displays which
show information merged from multiple tables.
I'm having trouble with one of the scrolling displays which is
implemented as a DataGrid with several custom DataGridColumnStyles.
When the Form containing the DataGrid is made visible the initial
rows of the DataGrid's DataView source display as one might expect....
|
by: Fortra |
last post by:
I'm having trouble with the UpdateCommand event with the
DataGrid control. The event is wired up in the
InitializeComponents properly,
this.sitesDataGrid.UpdateCommand +=
new System.Web.UI.WebControls.DataGridCommandEventHandler
(this.sitesDataGrid_UpdateCommand);
but when the "Update" button is clicked, the eventhandler
is never fired. The "Edit" command fires its
|
by: Guy Noir |
last post by:
I am having trouble wrapping my head around a datagrid and datasource.
I have it working, sort-of, but I'm having trouble refreshing my views.
Here's what I have:
A dataAdapter and dataSet generated by the wizards.
I click my Orders button, grid displays as expected.
I click my drop down box to filter out some specific records, every
thing works as expected.
|
by: martin |
last post by:
Hi,
I am iterating through the dataitems in a datagrid and producing and xml
document,
If a particular cell in the datagrid has a textbox control or a datagrid
control in it then I have no problem retrieveing it value by casting with
CTYPE
however when the datagrid cell contains no control, but does contain text,
then I am having great trouble accessing its value.
|
by: student |
last post by:
Hi all, I'm having trouble with my datagrid, it is suppose to display a row
from a table called "Calls" based on what is selected in the dropdownlist
which displays the first and last name from another table called "Contacts".
The problem is only the dropdownlist is showing in the browser and nothing
from the datagrid shows.
Could someone please point out my error, I am new at this, and would
appreciate some help.
thanks,
student
Here's...
| |
by: thegame |
last post by:
Filling One DataGrid Based on Selection from Another DataGrid - Both in
Separate User Controls
Hello, I have an interesting dilemma.
I have an ASPX page with two user controls (two ASCXs). Both ASCXs have
DataGrids on them. The first user control's DataGrid is populated from our
database on page load. The DataGrid also has a Select LinkButton.
|
by: cwbp17 |
last post by:
I'm having trouble updating individual datagrid cells.
Have two tables car_master (columns include Car_ID, YEAR,VEHICLE) and
car_detail (columns include Car_ID,PRICE,MILEAGE,and BODY);both tables have a
FK relationship on CAR_ID
so the oracledataadapter1 select statement(CommandText) is:
select car_master.car_id,
car_master.year,car_master.vehicle,car_detail.car_id AS EXPR1,
|
by: ghommel |
last post by:
I really, really hope someone can help me. this is a very urgent need. for some reason it seems like no one is knowledgeable enough, myself included, to know the answer.
I am trying to make a custom control that inherits the datagrid class which will contain a nested grid for hierarchial data. my problem is that i can't seem to even get past the basic step of getting the grid to display on the web form. it appears to be registered properly...
|
by: Jeff User |
last post by:
Hi
I tryed to solve this problem over in the framework.asp group, but
still am having trouble. Hope someone here can help.
using .net 1.1, VS 2003 and C#
I have an asp.DataGrid control with a Delete button on the end of each
row. I am unable to gain access to the event when the button is
clicked.
I don't fully understand how the click gets connected to the C# code,
|
by: sumitdipsite2005 |
last post by:
I am trying to use VB6 as a middleware between two 3rd party applications.
"App. A" ----> VB6 ------> "App B"
i am having no trouble sending data from VB to the "App B".
But i am having some trouble in reading data from "App A".
|
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...
| |
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...
|
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,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |