|
I have one datagrid for fetch and display the values from the table.
I need to adding items to datagrid at runtime using vb.net.
I want the code.
my code is
Dim con As SqlClient.SqlConnection
Dim Cmd As SqlClient.SqlCommand
Dim da As SqlDataAdapter
Dim ds As New DataSet
Dim constring As String = "data source=ccs10; initial catalog=gcis;user id=jpa;password=jpa"
Private Sub Btn_Raise_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Raise.Click
Dim CoMm As String
con = New SqlClient.SqlConnection(constring)
cmd=new sqlclient.sqlcommend("Select * from Paperrfq")
da = New SqlClient.SqlDataAdapter(cmd)
da.Fill(ds, "paperrfq")
DataGrid1.DataSource = ds.DefaultViewManager
aruljothi
|
|
|
|
|
Can you please be more specific on the nature of your problem? Please tell more about your data fields that you need to display. I am saying this because I do this all the time and maybe I can help you.
Aartee.
...HE is watching Us All!
-- modified at 3:02 Tuesday 30th August, 2005
|
|
|
|
|
hello mam,
Thanks for ur reply.i am a beginner in dotnet.i wud like to know about the data grid functionality.my requirement is i should be able to view the data in the datagrid from the database as well i want to enter new data in the same data grid to update my database.is this possible in vbdotnet and pls help me in getting things right.
I have more datafields in a table and display that in a datagrid.
Datafields are Empno as integer,empname as string
thank u
aruljothi
|
|
|
|
|
Hi ArulJothi,
---my requirement is i should be able to view the data in the datagrid from the database as well i want to enter new data in the same data grid to update my database.is this possible in vbdotnet ---
Yes it is possible to view the data as well as to update it. There are a couple of ways to do it,
1.In your SQL statement write a select stt to display the fields you need in the datagrid, do the rest of databse-connectivity,bindgrid() etc..coding. In your datagrid include a 'Hyperlink' column for 'change/Update Form' and redirect the link to your actual form by providing a 'URL' in the url field of the Property Builder i.e. Propertybuilder-->columns-->hyperlink column-->
HeaderText:Change/Update-->text:Update-->URLField:[your primary key of the form/table]eg:formNo-->URLFormat string:[your original form name not the datagrid one]eg: formname.aspx?formno={0}
this way your datagrid will bring you straight back to the form, you can make changes and save and the changes will be reflected in the datagrid.
2. Add the 'Edit,Update,Cancel' button and write the sub say, updatetable for update and edittabel for edit on the datagrid code behind page, include OnUpdatecommand="updatetable" and Oneditcommand="edittable" in the HTML page. so this will edit the columns and you can make changes to the fields you included in your datagrid(not form) and update it.
I hope this helps .let me know if you need more clarifications on any of the above.
good luck.
Aartee.
...HE is watching Us All!
|
|
|
|
|
hi,
i think u said for web application, may i get the solution for window application to add/update/delete at runtime
|
|
|
|
|
Hi,
I want to display a message box without showing a OK button. This I need because I have to display a processing message in an application which is in the process of displaying a website in the axBrowser window.
Can anybody reply me....
Thanks in advance..
Regards,
Jaya
|
|
|
|
|
If you want no button at all, then you need to create your own. Also, if you create a modal dialog, as the Message Box is, nothing will happen while it is being shown, unless it's in another thread.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
Can you please tell me whether I can able to disable the OK button of message box while using in Windows application with C# code.
If this is possible I shall be able to close the message box after a while.
Thanks in advance,
Regards,
Jaya
|
|
|
|
|
No, you can't. You will still need to create your own dialog, a trivial task in any case.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi ,
I have a datagrid in which I have a button column 'Delete' that works by calling 'Ondatagrid_deleteCommand'.
My problems is when I try to delete a record by clicking on 'Delete' button in datagrid, I get the following error
"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index "
I am clueless as to why this is happening since the same routine is working in other application which is exactly similar and ofcourse in which I am using a datagrid.
The sub for delete command is as follows:
**************************************************************************************************<br />
Sub DataGrid_DeleteCommand(sender As Object, e As DataGridCommandEventArgs)<br />
'Create the objects for the connection<br />
Dim myConnection As New SqlConnection(ReadDBConnectionString())<br />
Dim DeleteCommand As SqlCommand = new SQLCommand()<br />
Dim Transaction as SQLTransaction<br />
<br />
'Define the Query<br />
<br />
DeleteCommand.CommandText = "DELETE from chequedata where cheqregno= " &DataGrid.DataKeys(e.Item.ItemIndex)<br />
'Add the Parameters to the Query with the actual Value<br />
<br />
DeleteCommand.Connection = myConnection<br />
<br />
<br />
'Start Try Block<br />
Try<br />
'Open Connection<br />
myConnection.Open()<br />
'Begin Transaction<br />
Transaction = myConnection.BeginTransaction()<br />
'Tell Command Object which Transaction to use<br />
DeleteCommand.Transaction = Transaction<br />
'Execute the SQL Command<br />
DeleteCommand.ExecuteNonQuery()<br />
'Nothing happend - Commit Transaction<br />
Transaction.commit()<br />
'Show Message in Label<br />
lblMessage.Text = "Entry deleted"<br />
catch ex as Exception<br />
'Failure occured - Rollback Transaction<br />
Transaction.RollBack()<br />
'Write Message in Label<br />
lblMessage.Text = "Entry Not deleted"<br />
Finally<br />
'Close connection<br />
myConnection.Close()<br />
<br />
DataGrid.EditItemIndex = -1<br />
'Refresh the Grid and show changes<br />
RefreshGrid(Cint(ddlBranch.SelectedITem.Value),txtsearch.text)<br />
<br />
End Try<br />
End Sub<br />
***************************************************************************************************
Thankyou all for all the help. It is much appreciated.
Aartee.
...HE is watching Us All!
|
|
|
|
|
I wanted to make a vb application which would dial a telephone number using
the modem. When the person on the other end lifts up the telephone (answers
the phone), the application should start playing an audio file(eg. .wav
file).
The approach I took was using the Tapi. As my modem is connected to the
serial port on my computer I send AT commands to make the phone call . This
is working fine and the call is being placed.
I wanted to know whether this is possible at all? Whether I am approaching
the wrong way? If it is possible, then please give some suggestions or
samples(vb or vc). If it is not possible , then what is the best way to do
so
|
|
|
|
|
Hi,
After searching the web and finding nothing, I'm trying this forum to find some answers.
1) There is two type of hotfixes for Windows (type 1 and type 2). How can I get this type. Somebody know what I could check to get it.
Something like GetHotfixType(sHotfixPath) and return 1 or 2.
2) I need to get a DLL language but can hardly find informations about a way of doing it.
Sample code in any programming language would be appreciated. I need it for VB but it don't matter, I'm gonna do the conversion.
Thank you for replying. Any information is welcome.
|
|
|
|
|
1) There's no way to tell the difference since the difference was how the hotfix was installed, not what was installed.
2) That information is not stored in the .DLL at all. The final binary doesn't know anything of the language that it was written in.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I think my question #2 wasn't very clear but anyway thanks Dave for your reply. I finally end up with this function. I already had what I wanted in my API functions (GetFileVersion which is almost the same).
<br />
'Return the language codepage of the file.<br />
Public Function GetFileCodepage(r_sFilePath As String) As Long<br />
<br />
Dim lSetToZero As Long<br />
Dim lByteArrSize As Long<br />
Dim aByteArr() As Byte<br />
Dim lTransPtr As Long<br />
Dim lTransLen As Long<br />
Dim lCodepage As Long<br />
<br />
lByteArrSize = APiGetFileVersionInfoSize(r_sFilePath$, lSetToZero&)<br />
<br />
If lByteArrSize > -1 Then<br />
<br />
ReDim aByteArr(lByteArrSize)<br />
<br />
If ApiGetFileVersionInfo(r_sFilePath$, 0&, _<br />
lByteArrSize&, aByteArr(0)) Then<br />
<br />
If ApiVerQueryValue(aByteArr(0), _<br />
"\VarFileInfo\Translation", lTransPtr&, lTransLen&) Then<br />
<br />
ReDim aByteArr(lTransLen)<br />
ApiRtlMoveMemory aByteArr(0), ByVal lTransPtr&, lTransLen&<br />
ApiRtlMoveMemory lCodepage&, aByteArr(0), 2&<br />
<br />
GetFileCodepage = lCodepage<br />
<br />
End If<br />
End If<br />
End If<br />
<br />
End Function<br />
For question #1, it must be something in Hotfixes binaries that tells which type it is. I'm not sure there is no way. I'll keep searching.
|
|
|
|
|
This if from the Windows 2000 Hotfix Installation and Deployment Guide[^]:
Hotfixes are packaged in a self-installing format. There are two main types of hotfix installations:
The update installation
Use this type of installation to install Windows hotfixes on computers that are already running Windows 2000.
The combination installation
Use this type of installation to perform an unattended installation of Windows hotfixes in combination with Windows 2000 or the service pack (or both).
There is NOTHING in the binary to tell you which type of hotfix it is. This is because the only difference is in the command line switch that was used to install the hotfix. There is nothing in the binary that will tell you how it was installed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i want to get the harddisk and processor id in vb.net...
is that possible...as i am writing a security utility....please guide me..
|
|
|
|
|
Hello all this is my first post here , hehe...
I wrote a function that returns a datarow .The datarow was created and declared within the function(it is not public).My question is does the datarow that was declared within that function gets disposed automatically or am I ending up with an extra datarow residing within memory(the created datarow and the receiving datarow) ?
-- the function is short:
Public Shared Function getDrow()as DataRow
dim dr as Datarow
--creates the datarow
return dr
End Function
implementation:
dim o as Datarow = getDrow
|
|
|
|
|
well! for your information the variables exist in a function are diposed automatically by the .net garbage collector...
in technical way the .net memmorry management is non-deterministic i.e. dot net manages it automatically....
so you don't need to worry in the function case it will be disposed automatically.....
hope that helps
|
|
|
|
|
Thanks m8 , I guess it's only logical what you're saying , I just needed the feedbackup. Cheers !
|
|
|
|
|
It is impossible to "see" into another persons XP (home edition) session from your own loggon session on the same computer.
I am trying to create a program which will be able to log keys accross widows sessions. I have got as far as logging keys using user32.dll but leaving a keylogging program running then switching user will not work because of the above problem. Your own loggin is unable to recieve the raw ascii sent to the dll on the other persons session.
Therefore:
Is it possible to make a VB application act as part of the OS so as to make it possible to see over sessions. Or are there any other solutions?
Cheers
°[Halo]°
|
|
|
|
|
The only thing that can do that is a Windows Service. You'll have to write a low-level keyboard hook into the service to get the keyboard messages as they come out of the keyboard driver.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So it's impossible to do this in VB?
°[Halo]°
Project Basilisk
|
|
|
|
|
Since you're asking this, I'm assuming your using VB6. VB6 can't target building a Service directly, so you have to use third party components to get it to work.
Low level keyboard hooks are also much more difficult to do in VB6.
VB.NET will target building a Service and can do keyboard hooking much easier than VB6. But, the ultimate is ease is done in C++.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a form named form1 and it contains one AxWebBrowser control.
Here is the code:
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Close()
End Sub
I get the following error.
An unhandled exception of type 'System.ObjectDisposedException' occurred in system.windows.forms.dll
Additional information: Cannot access a disposed object named "Form1".
Note: if the AxWebBrowser control is not on the form then i do not get any error.
How do I close form1 with the AxBrowser on it? Thank you.
Jonathan Elsner
|
|
|
|
|
You should never close a form in it's Load event. You should be deteremining if the form should be loaded before you even attempt to load it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|