|
Instead of doing this, you can just create a struct that contains your three values and make an array of this struct your data source, then set up the grid to render it however you like.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thank you Christian,
Yes that can be one of the way. But I am not too experienced with it.
There is a object called DataGridViewCell which can be inherited to create my own myCustomGridViewCell
But the thing is how can I tell the DataGridView to use myCustomGridViewCell instead of default DataGridViewCell. I know there is a way but trying to figure out. This will be easiest way of saving as many differect values as possible in one cell. And you can easily Set or Get them by:
DataGridView1.item(0,0).myValue1 = "This is first Custom Value"
DataGridView1.item(0,0).myValue2 = "This is Second Custom Value"
DataGridView1.item(0,0).myValue3 = "This is third Custom Value"
I can create myCustomGridViewCell by creating a Public Class (as shown below)
Public Class myCustomGridViewCell
Inherits DataGridViewCell
Public myValue1 As String
Public myValue2 As String
Public myValue3 As String
End Class
The problem is how can I tell the DataGridView to use myCustomGridViewCell
There will be a way to override the DataGridView1 class to define my custom obects.
|
|
|
|
|
Hi I'm trying to get the datagridview cell value into listcontrol.
The reason why I importing datagridview data into listcontrol is to be able to change the header fields name.
I tried to find the way to right click on mouse and edit/rename the datagridview headercell name.
For example,
"No" "date" "address" header to "Number" "Date" "Address".
I want to be able to edit the header string when the user click on Right button on mouse or double click on mouse, Like we can edit table header name by double clicking in Microsoft Access.
I couldnt' find any example to do so. I guess datagridview doesnt' allow to edit the header name.
So I decided to use the listview control to do the same action.
So How can I make it so the header is editable when the user click on right click or double??
Thanks.
|
|
|
|
|
Ok. Here is my scenarion I have a file that I need to load some line to a grid, but
I'm have diffulties doing do. The following is the structure of my file.
0 62.5 0 0 62.5 0 0 62.5 0 0 'H2O'
0 115 461.5 461.5 115 461.5 461.5 115 461.5 461.5 'CH'
0 90 76.9 76.9 95 107.7 107.7 90 76.9 76.9 'CH'
0 97 76.9 76.9 97 107.7 107.7 97 76.9 76.9 'CH'
0 97 76.9 76.9 100 153.8 153.8 97 76.9 76.9 'CH'
I need to assign each number to a variable to load into my grid.
Help please.
|
|
|
|
|
The System.IO namespace has the classes you need to read files. I think that My gives you a shortcut as well. System.IO.File.ReadAllLines will read your file into a string array, a string per line. You can then call the Split method on the string class to turn each line into a string array ( split on space ). Then double.TryParse can be used to find all the numbers, and you'll always know that the last element is a string, so treat that accordingly.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
my be you should try file manipulation..
ex:
While yourFileHandler.Peek <> -1
yourArray = split(yourFileHandler.Readline()," ")
For i as Integer =0 to Ubound(yourArray)
'yourArray(i) do assigning the value of array here into your datagrid
Next
End While
|
|
|
|
|
Here is some bits of code (not complete) I have used to do somthing similar.
1) it opens the launch.ini file
2) creates a streamreader and puts the content of the file into infile
3) then it reads infile one char at a time building a temp string until it reads a comma (in your case it would be a space)
4) On reaching a comma it stores the value in a string (in the example IP and Mac)
Hope this helps you get started.
thefile = "c:\launch.ini"
Try
fs = New FileStream(thefile, FileMode.Open)
Catch excep As System.IO.FileNotFoundException
Exit Sub
End Try
Dim sr As StreamReader = New StreamReader(fs)
Dim infile As String ' String used to accept file input
Dim c As Char
Dim count As Integer
Dim temp As String
infile = sr.ReadToEnd
sr.Close()
fs.Close()
'MessageBox.Show(infile)
count = 0
Do
c = infile.Substring(count, 1)
count = count + 1
If c <> "," Then temp &= c
Loop While c <> ","
ip = temp
ipbox.Text = ip
temp = ""
Do
c = infile.Substring(count, 1)
count = count + 1
If c <> "," Then temp &= c
Loop While c <> ","
mac = temp
macbox.Text = mac
temp = ""
|
|
|
|
|
|
Can anyone tell what is the vb.net code for displaying an image using microsoft office document imaging viewer control 11 and how to zoom in or out of an image.
It would be something like the following
picImage.Image = New Bitmap("c:\test.tif")
or to zoom picImage.zoom = 50
|
|
|
|
|
Please don't make your project rely on office, merely to show a bitmap.
Handle your Paint event. In there, draw the bitmap, using the Graphics object in the event args, and the DrawImage method. The Graphics object also has a ScaleTransform method, you can call this to change the zoom of your bitmap, or you can manipulate the parameters to DrawImage to do it.
It's pretty straightforward.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thanks everyone for all their help.
I have done the following code and it works. Hopefully this will be useful to others. All you need on your form is a Panel, Picture Box (this goes inside panel) and a button
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
picImage.Image = New Bitmap("c:\test.tif")
' Get the source bitmap.
Dim bmSource As New Bitmap(picImage.Image)
' Make a bitmap for the result.
Dim bmDestination As New Bitmap(
CInt(bmSource .Width / 8), _
CInt(bmSource .Height / 8))
' Make a Graphics object
Dim grDest As Graphics = Graphics.FromImage(bmDestination)
' Copy the source image into the destination bitmap.
grDest.DrawImage(bmSource, 0, 0, _
bmDestination.Width + 1, _
bmDestination.Height + 1)
' Display the result.
picDest.Image = bmDestination
End Sub
|
|
|
|
|
Hi,
I'm writing a small app that will retrieve the assembly version number of all assemblies in a particular folder.
To do this I'm loading each assembly into its own app domain, getting the info I need and then unloading the app domain. But this still leaves the assemblies locked - they are only unlocked when I exit the application. How can I get around this?
To be able to load each assembly in its own app domain my own application has to be running from the same location as the assembly. Is there any way around this?
The code I use is below:
<code>
Private Sub ListProjects(ByVal root As String)
Dim baseDirectory As New DirectoryInfo(root)
Dim assemblies As FileInfo() = baseDirectory.GetFiles("*.dll")
For Each fi As FileInfo In assemblies
Dim fileVersion As String = String.Empty
Dim assemblyVersion As String = String.Empty
Dim name As String = fi.Name
Dim path As String = fi.FullName
Dim appDomainName As String = name.Substring(0, name.LastIndexOf("."c))
If name.ToLower.EndsWith("vshost.exe") Then Continue For
Dim ad As System.AppDomain
Dim assem As System.Reflection.Assembly
ad = System.AppDomain.CreateDomain(appDomainName)
assem = ad.Load(System.Reflection.AssemblyName.GetAssemblyName(path))
fileVersion = GetFileVersion(assem)
assemblyVersion = GetAssemblyVersion(assem)
Debug.Print("App Domain = " & ad.FriendlyName)
Debug.Print("Assembly name = " & name
Debug.Print("File Version = " & fileVersion
Debug.Print("Assembly Version = " & assemblyVersion
Debug.Print("==========================================")
AppDomain.Unload(ad)
Next
End Sub
</code>
Thanks,
dlarkin77
|
|
|
|
|
How to use a button created in Maceomedia Dreamweaver, on a vb.net form
|
|
|
|
|
Is the button animated ? If not, just do a screen capture, save teh bitmap, and put it on the button.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
i develop a project that has a feature of sending sms message.. does any one here know how to implement this using vb.net 2005 and my mobile phone(Nokia N70)...
|
|
|
|
|
|
Does anyone know how can i play a MP3 file or other multimedia file?, because in the vb we can only play wav file
|
|
|
|
|
By using DirectShow or the Windows Media Player control.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Can someone tell me what's the sqlce connection string in vb.net environment?
I get the error as below:
Description:
Deployment and/or registration failed with error: 0x8973190e. Error writing file '%CSIDL_PROGRAM_FILES%\test\test.exe'. Error 0x80070020: The process cannot access the file because it is being used by another process.
File:
Device Connectivity Component
I had restarted my PC but the problem still there.
|
|
|
|
|
Hi all,
We have an aspx which show a list of crystalreports in pdf formats.Now user wants to print all of them at one GO.We are able to show all the PDF's in one PDF but when we give Print command it shows empty page.
So can we print the reports directly to the printer all at one go.Please help me with the coding.
"PLEASE HELP ME ITS VERY URGENT"
My code goes like this
Dim rArray(Rlist.Count + rList1.Count - 1, 1) As String
Dim counter As Integer
For counter = 0 To Rlist.Count - 1
Dim oneReportItem As ReportInfo = Rlist.Item(counter)
reportsArray(counter, 0) = oneReportItem.SchID
reportsArray(counter, 1) = oneReportItem.ReportID
Next counter
For counter = Rlist.Count To UBound(rArray, 1)
Dim oneReportItem As ReportInfo = RList1.Item(counter - Rlist.Count)
reportsArray(counter, 0) = oneReportItem.SchID
reportsArray(counter, 1) = oneReportItem.ReportID
Next counter
Session("reports") = reportsArray
Durga
|
|
|
|
|
I already have a connection for my project; how do I use the sql commandtext and define the connection without going through the conn = MS jet; path etc. If I have to do the conn = ms jet, path, etc. will I be opening another connection to the same database?
Thanks for your time. Scott
|
|
|
|
|
Hello Folks,
I am trying to overide my .net 2.0 DataGridView
I have a gird of 10x10 thus I have hundred cells in that grid. But for each cell I want to save three values. I have override my Treeview to save three values but cannot do the same for DataGridView component. Any Hints please
Umair
Umair Lateef
|
|
|
|
|
GWbasicProgrammer wrote: But for each cell I want to save three values
And those would be??? Each cell can only hold a single value or object, so you'll have to provide a bit more detail as to what your talking about.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
VS 2005 / Framework 2.0 allows you to store settings as User Settings and Application Settings replacing the older style App.Config in Framework 1.0. You can now publish your application and any updates can be forced to the end-user. Unfortunately when you publish the user settings that the client is able to change with my form and save, get wiped out to default. Also, if I setup Isolated Storage for the settings to be stored into, when I re-publish once the app has been in production for a while, it resets everything to default.
Am I missing something? Microsoft gives you the capabilities to store a users own settings for their app, but boom when you republish, the settings get reset to default.
Any insight is appreciated..
Lost in the vast sea of .NET
|
|
|
|