|
Hi, i am new to ado.net so soory, if it seems like a stupid question.
I have filled a datatable with data by a simple query.
i have a datagrid, which doesn't need to show all the columns of the table,
how can i show only some of the columns without needing to query again?
can a dataview show parts of the datatable i have?
thanks,
Nir.
|
|
|
|
|
Hi Nir,
look into the tablestyles and columnstyles properties of the datagrid. you basically create a tablestyle with a mappingname = your datatable.name property and a columnstyle for each column that you wish to display with a mappingname = your datacolumn.columnname property. this can be done at design time through the designer or through code, whichever is easier for you. find docs on tablestyles here, and here's an article describing how to accomplish exactly what you're looking to do.
good luck.
-jim
|
|
|
|
|
Thanks for your help, it worked.
|
|
|
|
|
Hello Nir!
Try out this statement b4 binding the datatable with datagrid..
If dt is the datatable
dt.Columns("ColName").Dispose() <----
_mubashir
|
|
|
|
|
Thanks for your help, i managed to create the table style.
|
|
|
|
|
VS 2003
vb.net
Crystal Report 9
;P;P Now I am facing a big probelem.
I make a project I want to put the project in another system
that is windows 98.But the problem is not working the exe generate a
exception the message (processid =oXfffcblal (-216671),Thread
id = oXfffcc941). I have instaled Frame worke poperly.
In my project I have used Crystal Report com file name
(Crystal Report viewer Control 9) this is main reason. I have checked
in many ways I got a message beginnig the instalation.
unicows.dll is messing. The instalation is failed. Then I got
another message could not register the file .I introduce above my
setup package.How can solve this problem
Anybody help me please.
Continue...
-- modified at 8:12 Friday 26th August, 2005
|
|
|
|
|
did you included the Merge Module of Crystal 9 and put the CD Key in the license file before building the package ????
|
|
|
|
|
can someone help me with the ftp! i want to connect with the ftp through vb.net and download a textfile, edit it in vb.net and upload it back! Do i need to install any dll? Help me please!
|
|
|
|
|
|
I have built one function which creates one text file then work on it and then after processing on the file it deletes the file.
the problem is when I delete the file it gives error that the file is in use.
the code is
Dim txt As IO.File
Dim tmp As System.IO.FileStream
tmp = txt.Create("C:\abc.txt")
tmp.Close()
If txt.Exists("C:\abc.txt") = True Then
fl = txt.AppendText("C:\abc.txt")
fl.Write("testing")
fl.Close()
End If
fl=nothing
txt = Nothing
GC.WaitForPendingFinalizers()
GC.Collect()
'kill("C:\abc.txt")
' or
System.IO.File.Delete("C:\abc.txt")
' THIS DELETE LINE GIVES ERROR
THE ERROR IS
Message "The process cannot access the file "C:\ABC.TXT" because it is being used by another process."
|
|
|
|
|
Rizwan Bashir wrote:
tmp.Close()
You didn't call .Dispose() on the FileStream objects. Do that and you'll be all set.
Forget using the GC class for this. Just remove that code.
Dim txt As IO.File
Dim tmp As System.IO.FileStream
tmp = txt.Create("C:\abc.txt")
tmp.Close()
tmp.Dispose() ' Tells the FileStream object to release the underlying unmanaged file handle
If txt.Exists("C:\abc.txt") = True Then
fl = txt.AppendText("C:\abc.txt")
fl.Write("testing")
fl.Close()
fl.Dispose() ' Same thing...
End If
The next four lines are unneccessary
'fl=nothing
'txt = Nothing
'GC.WaitForPendingFinalizers()
'GC.Collect()
System.IO.File.Delete("C:\abc.txt")
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
there is nothing called Dispose in any of these variables
fl.dispose() ' not available
tmp.dispose() ' not available
txt.dispose() ' not available
there was only close option in fl.close() which I used.
|
|
|
|
|
Actually, you're right. My mistake. That's what I get for spending a day writing a couple of large Dispose implementations in a couple of my classes...
Ok, no Dispose. Close should do it, so what's the exception you're getting?
This works...
' Put this at the top of your code
Imports System.Io
' The first Dim is unneccessary...
' Dim txt As IO.File
' Condensed the next few lines...
Dim tmp As New StreamWriter("C:\abc.txt", FileMode.Create)
tmp.Close()
' The IF statement is unneccessary considering it will ALWAYS return true.
' Where is fl defined and how???
fl = File.AppendText("C:\abc.txt")
fl.WriteLine("testing")
fl.Close()
File.Delete("C:\abc.txt")
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks Dave. I put the text file in system temporary folder and now I can delete the file. I think I had the problem of security on the folder where I could not delete the file..
|
|
|
|
|
That was going to be my next question...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I see you found the problem,
Sorry dave, I didn't know you were still working on this..
progload
-- modified at 11:59 Friday 26th August, 2005
|
|
|
|
|
Hi,
is there anyway that I can list out all the Windows user and group using vb.NET?
thanks
|
|
|
|
|
Dim oDomain, Member As Object
oDomain = GetObject("WinNT://" & "MyDomainName")
For Each Member In oDomain
If Member.Class = "Group" Then
Console.Writeline(Member.Name)
End If
Next
|
|
|
|
|
Thanks. I'll give it a try
|
|
|
|
|
Hello..
Can anybody tell me how to give readonly access to some of the rows in datagrid while leaving others as non-readonly. I have binded a dataset with the datagrid.
Plz reply urgently
Take care
|
|
|
|
|
Please give me some idea on how the Key_Press Event of a Form can recognize an input from a device (in particular, a barcode reader-like device). Some says it is through an 'ID tag'. Where can I find the ID Tag of a device? Or if it's not the answer, how is the best solution? Thanks for any help...
|
|
|
|
|
That depends on the device. That depends on the hardware and how it's connected to the machine. If it's USB, then it'll show up as a USB device. If it's connected to the keyboard, it'll just stuff keystrokes exactly like the keyboard does. If it's attached to the serial port, then you'll have to read data comming from the port.
The KeyPress event, obviously, will only work if the device is attached to the keyboard port, or if the device has a driver that reads what port it's on, then generates keyboard messages.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Pa'no po kapag nakakonek sa LAN Network? Hindi ko po sya nakitang direkta sa likod ng PC.
|
|
|
|
|
Uhhh.... This is an English-speaking board.
I have no clue what you just said...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I mean sir what if the time-tracking device is not connected directly at the back of the CPU used by HR. Instead, it is located somehow quite far from any computer, and it was just connected through Local Area Network. How can then I configure the KeyPress Event of Form in VB.NET for every input from that device?
|
|
|
|