|
In the section of code that loads the datatable to the grid, I had to store the datatable in a session variable.
sqlAdapter.Fill(sqlDataTable)
If Not (Session("TaskTable") Is Nothing) Then
Session.Remove("TaskTable")
End If
Session("TaskTable") = sqlDataTable
GridView2.DataSource = sqlDataTable
Here's the code for the "Sorting" event of the grid.
Protected Sub GridView2_Sorting(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView2.Sorting
Dim dt As DataTable
dt = TryCast(Session("TaskTable"), DataTable)
Dim dv As New DataView(dt)
If ViewState("SortDirection") Is Nothing Then
ViewState("SortDirection") = "ASC"
End If
If ViewState("SortDirection") = "ASC" Then
dv.Sort = e.SortExpression & " " & "DESC"
ViewState("SortDirection") = "DESC"
Else
dv.Sort = e.SortExpression & " " & "ASC"
ViewState("SortDirection") = "ASC"
End If
GridView2.DataSource = dv
GridView2.DataBind()
End Sub
Hopefully this will work for you, but I don't know if I would use this type of processing for large datatables and many users. Storing the datatable in a session variable take server memory and each person would have a copy of the datatable.
You could build a more sophisticated "GetData" routine and have the stored procedure return the data sorted for you, then re-bind it to the Gridview.
Hope this works for you.
|
|
|
|
|
Hello Shameel,
Thank you, how would I do that?
Thanks,
Dan
|
|
|
|
|
Follow David Mujica's instructions.
|
|
|
|
|
I did do a search but cannot find any sample. I am looking for a sample like this.
1. Search c: for say *.pdf files.
2. Show files in a grid with name of file, size, path.
3. Then I can delete all or just choose the files I want to delete.
|
|
|
|
|
Break the problem down into smaller problems:
1: get a list of files: http://www.developerfusion.com/code/3681/list-files-in-a-directory/[^]
2: Select the file you want in the list or datagrid (google will help you)
3: Perform the delete file on the selected record. (again google will do most of this for you).
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
You're never going to find an app that does all of this. You will however find examples for each of those steps. It's up to you to write the code to stitch all of those steps together in a single app.
|
|
|
|
|
Hello,
you can do something like this and then using a foreach loop, or list them on datagird.
Dim strFileSize As String = ""
Dim di As New IO.DirectoryInfo("C:\path")
Dim aryFi As IO.FileInfo() = di.GetFiles("*.pdf")
Dim fi As IO.FileInfo
For Each fi In aryFi
strFileSize = (Math.Round(fi.Length / 1024)).ToString()
'yourdatagridcell("File Name: {0}", fi.Name)
'yourdatagridcell("File Full Name: {0}", fi.FullName)
'yourdatagridcell("File Size (KB): {0}", strFileSize)
'yourdatagridcell("File Extension: {0}", fi.Extension)
'yourdatagridcell("Last Accessed: {0}", fi.LastAccessTime)
'yourdatagridcell("Read Only: {0}", (fi.Attributes.ReadOnly = True).ToString)
Next
Regards
Carmelo La Monica
|
|
|
|
|
Thank you
I am using this code to get files, but I can not get it to search for all files on C: drive.
How can I get it to show all files Like *.pdf of the dirve in the list box
Imports System.IO
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Public Class SearchAvi
Private Sub BtnGetAviFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGetAviFiles.Click
Dim dir1 As New IO.DirectoryInfo("c:")
Dim dir2 As IO.FileInfo() = dir1.GetFiles()
Dim files1 As IO.FileInfo
For Each files1 In dir2
FrmListBox.Items.Add(files1)
Next
End Sub
|
|
|
|
|
You also have search all SUBDIRECTORIES of a given Startpoint.
You should write a function getting all files and directories, and then you can call this function recursive (calling it for each subdirectory with an new startdir).
I cannot remember: What did I before google?
|
|
|
|
|
I suggest using a LIFO stack (Stack collection in .NET) in stead of recursing. I've done this a couple of times now and the basic algorithm works like:
Push start directory onto stack
loop while stack is non-empty
pop last element off the stack (directory)
do action on element (here: find all *.pdf files)
list all subdirectories and for each push full subdirectory path on the stack
end loop
|
|
|
|
|
I have an application that has a DBGrid on a dialog. When I view certain data in the grid, sometimes data is not displayed, but only when the application is installed on a Windows 7 machine. The exact same program works reliably on any XP machine. The grid has its "DataSource" property set to a Data ActiveX control. I know the data is read properly because i can loop through the data with a "while not eof" loop and see the data. I can also open the data in MS Access and use the exact SQL statement I am using to read the data for the DBGrid and the proper data is displayed.
Does anyone have any ideas? I have other applications that utilize these controls and I am afraid to upgrade any of my office PC's to Windows 7 becuse of this problem.
Thank you
|
|
|
|
|
Have you tried running the program in XP Compatibility mode under Windows 7?
|
|
|
|
|
Why are you not asking the manufacturer of the control this question??
They wrote it, they tested it, they support it. We didn't.
|
|
|
|
|
Is your Windows 7 machine 64-bit? I believe 32-bit ActiveX controls will not work in 64-bit applications.
|
|
|
|
|
True, but it won't cause an problem like this. He'll get some kind of "invalid image" error and the app won't even run.
|
|
|
|
|
Correct. I didn't read the question completely. Thanks for correcting me.
|
|
|
|
|
Hi all,
I've been tasked with ensuring our add-in works in both Powerpoint 2007 and Powerpoint 2010. We'd really rather not have to keep up with two sets of code - imagine the headaches that might entail. I've searched online and on CodeProject for what I need to do to enable functionality in both versions but apparently I don't have the right search terms. Anyone know of any article(s) or other postings that address this issue?
Thanks in advance for your assistance!
Denise "Hypermommy" Duggan
|
|
|
|
|
How about if you check the version of PP in your addin and react according to the version? I never programmed any PP addin and don't even know if you can read the version info but I know this works in Outlook and Word.
Tosch
|
|
|
|
|
I appreciate the answer. Yes, that does sound like a viable solution as long as I can code in VS2010 and it'll work in both of them. The problem I'm finding with coding this add-in is there's a dearth of information about programming for PowerPoint. Lots of info for how to use PP, but not much about programming for it.
But thanks for the assist. Any little bit helps.
Denise "Hypermommy" Duggan
|
|
|
|
|
Hi,
Is there a way to check if email is send or not in vb.net?
I have a program which will send an email using ms outlook.
When ever the user click the Email button on my vb.net form.
The email outlook message will display with it's recipients,
subject and body. Then user will just click the send button
after the user adds body information. Now,I want to trap
if user click the send button in email outlook form.
I want this so that if the user click the send button in email outlook,
I will automatically close the vb.net form.
Thanks in advance!
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
There is a Send-Event on the MailItem object in Outlook which is raised then the user hits the send button on an email.
Tosch
|
|
|
|
|
HOW TO MAKE SIMPLE WEB SERVICES IN VB6.0 ANY ONE KNOWS PLEASE EXPLAIN!!!!!!!!
THANKS YOU
WITH REGARDS
SATHISH
|
|
|
|
|
STOP YELLING!!!
You can't do it very easily. VB6 doesn't support it and writing a COM object that you host in an ASP web page is problematic at best.
Save yourself the immense pile of grief and move up to VB.NET where web services are very easy to write.
|
|
|
|
|
dineshp123 wrote: HOW TO MAKE SIMPLE WEB SERVICES IN VB6.0 ANY ONE KNOWS PLEASE EXPLAIN!!!!!!!!
Definitely not by shouting for "help" into a forum like that and using eight exclamation marks, the sure sign of an insane mind (according to Terry Pratchett).
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Hi to all,
I am trying to replicate Menu in Toolbar I can add a first level Toolbar Menu Item. But I am not able to second level or higher.
Is it possible to add multi level sub menu ?
Regards,
Nanda
|
|
|
|