|
We make extensive use of Datagrids in our project but a lot of the data displayed in the grid is either to big for the specific column or the column is to big for the data.
Can ANYONE tell me how to resize only certain columns in the datagrid????
|
|
|
|
|
Hi!
I've also tried this and went crazy doing so... I don't think it's possible.
My advice is to use a ListView Control. You can't use Databinding then, but you can resize your columns to whatever size you want....
If anyone knows how to resize the datagrid columns, i'd like to know how to do it, too!
Sorry I couldn't give you better advice...
-Timo
|
|
|
|
|
Heres how I arrive at my dilema (a very simplified example):
1. Create a new Window Application Solution.
2. Add to the project a new user control, lets call it UserControl1
3. Add 1 panel to UserControl1, lets call it Panel1. Dock it to the right and size it such that it takes up half of the available real estate.
4. On the main form for the application, place an instance (from the toolbox) of UserControl1 anywhere you like.
5. Now place a button in the panel of UserControl1.
Step 5 seems impossible. I would like to create a control type whose purpose is to contain other controls (and other things). But everytime I try and place this control in the Panel, it appears behind the panel. The container for the button is always UserControl1 not Panel1. How can I make the container for the newly placed button be Panel1 and not UserControl1? (Using typical Design View method (drag and drop).
Thanks for your time...
|
|
|
|
|
declare AddForm Lib "winspool.drv" Alias "AddFormA" _
(ByVal hPrinter As Long, ByVal level As Long, pForm As Byte) As Long
Who can give sample code
|
|
|
|
|
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B282474
|
|
|
|
|
That is in vb6.0.But now i use in vb.net.It can't work.
The reason is API Function CpoyMemory and AddForm can't use in VB.net.
|
|
|
|
|
Hi... I need help terribly... I'm using Visual Basic .NET.
As my subject, is there any way to convert Microsoft Words/Excel into an image programatically? Or is there any 3rd party component which allows me to manipulate the conversion programatically in my application? I wanna perform wat the Tablet PC Journal Writer can do, i.e. export the word .doc into an image and allows me to "ink" on it.
I would need VB.NET snipplets to understand.
Thank you..
|
|
|
|
|
I would look into opening the document using the Office Object Model and then seeing what formats are available to "save as" that document in.
|
|
|
|
|
I need to marshal a structure so that I can pass it to a C++ DLL and
vice versa. The following works correctly:
<structlayout(layoutkind.sequential)> _
Private Structure PLCDATA
<marshalas(unmanagedtype.i4)> Dim w1 As Int32
<marshalas(unmanagedtype.i4)> Dim w2 As Int32
<marshalas(unmanagedtype.i4)> Dim w3 As Int32
<marshalas(unmanagedtype.variantbool)> Dim b1 As Boolean
<marshalas(unmanagedtype.variantbool)> Dim b2 As Boolean
<marshalas(unmanagedtype.byvalarray, sizeconst:="5)"> Dim Arr() As Int32
Sub initialize()
ReDim Arr(4)
End Sub
End Structure
Now I need to have another item in the structure be an array of a
different structure. Hope that makes since. I thought this would
work but it gives me an error:
<structlayout(layoutkind.sequential)> _
Private Structure PARCEL
<marshalas(unmanagedtype.i4)> Dim Induct As Int32
<marshalas(unmanagedtype.i4)> Dim Dest As Int32
<marshalas(unmanagedtype.i4)> Dim Reason As Int32
End Structure
<structlayout(layoutkind.sequential)> _
Private Structure PLCDATA
<marshalas(unmanagedtype.i4)> Dim w1 As Int32
<marshalas(unmanagedtype.i4)> Dim w2 As Int32
<marshalas(unmanagedtype.i4)> Dim w3 As Int32
<marshalas(unmanagedtype.variantbool)> Dim b1 As Boolean
<marshalas(unmanagedtype.variantbool)> Dim b2 As Boolean
<marshalas(unmanagedtype.byvalarray, sizeconst:="5)"> Dim Arr() As Int32
<marshalas(unmanagedtype.byvalarray, arraysubtype:="UnmanagedType.Struct," sizeconst:="3)"> Dim Items() As PARCEL
Sub initialize()
ReDim Arr(4)
ReDim Items(2)
End Sub
End Structure
The error I get looks like this:
System.TypeLoadException: Can not marshal field Items of type PLCDATA:
This type can not be marshaled as a structure field.
at Test_PLCData.Form1.ReadFromPLC(PLCDATA& pRead)
at Test_PLCData.Form1.Button1_Click(Object sender, EventArgs e) in
C:\Esanti Code\C++\PLC_Data DLL\VB.NET Test App\Test PLCData\Test
PLCData\Form1.vb:line 106
Can anyone tell me how to get this to work correctly? Thanks in
advance!!!
|
|
|
|
|
I m writing the C# version up here. try with similar in yor code.
// The Person structure
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct Person {
public string firstName;
public string lastName;
}
// The Bank account structure. Note the use of an IntPtr
// to hold the pointer to the account holder
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct Account {
public IntPtr accountHolder; //I m using Intptr not Person.
public string accountName;
public long accountNumber;
public double balance;
}
|
|
|
|
|
If you wanted a fixed array size of the Person structure how would you do it?
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
public struct s1
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst=16)]
public long[] vals;
}
Is this u want???
|
|
|
|
|
No, I need an array of a structure inside another structure.
StructLayout(LayoutKind.Sequential)]
public struct s1
{
[MarshalAs(UnmanagedType.I4)]
public int val;
}
StructLayout(LayoutKind.Sequential)]
public struct s2
{
[MarshalAs(UnmanagedType.Struct, SizeConst=16)]
public s1[] vals;
}
Something like that. Take a look at my original post.
|
|
|
|
|
I'm a vb.net noob who needs some help. Is there a way to get the size of a specified folder? I'm using this code to get all sub-directories of a specified folder and would like to also retrive the folder size of each.
Dim myPath As String = "C:\test"
Dim myDirectory As System.IO.Directory
Dim mySubDirectory As String
Dim myDirectorySize As String
If myDirectory.Exists(myPath) Then
For Each mySubDirectory In myDirectory.GetDirectories(myPath)
MsgBox(mySubDirectory)
Next
End If
Any ideas?
|
|
|
|
|
Private Function DirectoryList(ByVal Name As String) As Int64
Dim Folder As New DirectoryInfo(Name)
Dim SubFolder As DirectoryInfo
Dim File As FileInfo
Dim Size As Int64 = 0
'Get the size of all files in folder
For Each File In Folder.GetFiles()
Size += Files.Length
Next
'Get the size of all subfolders in folder
For Each SubFolder In Folder.GetDirectories()
Size += DirectoryList(SubFolders.FullName)
Next
MsgBox(Name & " containes " & Size & " bytes")
Return Size
End Function
|
|
|
|
|
Sorry, I was a little quick there...
A simple sollution would be to make a recursive function, like the one in the example in the preceding thread. The topmost folder will be displayed last...
|
|
|
|
|
Thanks, I appreciate the help.
|
|
|
|
|
In my script I try to open an URL programmatically. This is no problem :
<br />
Set IEApp = CreateObject("InternetExplorer.Application")<br />
IEApp.Navigate "http://www.mydomain.com"<br />
<br />
Do While (IEApp.Busy = true)<br />
WScript.Sleep 200<br />
Loop<br />
Aftwards I would like to access to a login form and set username and password to specific values. This is where things get complicated:
<br />
Set IEDoc = IEApp.Document<br />
The object I get is from type HtmlDocument, which is read only and contains pure html tags. I cannot use it to access to forms and elements.
Does anybody know how I can access these elements ?
Regards
Daniel
|
|
|
|
|
Hi all,
I create an OCX using VB6. The functions in this OCX are:
Public Function TestByte(MyByte as Byte) As Byte
Public Function TestInt(MyInt as Integer) As Integer
Then I try to use this OCX in a MFC project and realize that MFC cannot recognize VB's "Byte". Thus the function TestByte cannot be imported to the MFC application.
My question... WHY??? isnt byte a very basic data type?
I can go round this problem for now... but this is a really intriguing. Feel free to tell me why... ) Thanks.
|
|
|
|
|
AFAIK, Byte in VB is BYTE in MFC/Win32 (or just use unsigned char). It's just a naming inconsistency between those platforms, and you should still be able to call the OCX - the interface generated for C++ would use BYTE TextByte(BYTE MyByte) as the definition (or something similar)
Of course, all my experience with this is going the other way round - C++ control, VB application.
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
Hi Ian,
Actually I did a reverse after posting this message (writing an OCX using VC to use in VB). It appears that, OLE dont support BYTE as a parameter for OCXs... i do not understand why.
I understand what you mean, Byte in VB is 1 byte, BYTE in VC is 1 byte, they are the same. I wrote DLLs for VB using VC before, and they work together... just that for OCX...
Am I correct? or is there really a away to do it? Anyway, thanks for your help. )
Keh
|
|
|
|
|
|
What is the best way to detect which applications are installed on a machine and where the executable for the installed application resides. Since I'm working with older machines many of the applications were not installed with the windows installer specs.
|
|
|
|
|
The registry stores the uninstallation information in the key 'HKEY_LOCAL_MACHINE\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall', I presume you could trawl through the list of sub-keys to get a list of applications that are registered as installed on the system. Other than that I'm not aware of a way of detecting whether a program has been 'installed' or not, without the registry mechanism.
Hope this helps.
Alan.
P.S. note that you'll only get the path to the UNINSTALL.EXE, but I'm sure you can strip the path down to find its root folder for searching. Not all programs keep the uninstall.exe in the actual installation folder, but if you extract the program name and perhaps search for it in the registry you may find it...who knows, it certainly isn't simple
|
|
|
|
|
Can i get all error with one function? (not error handler and goto and ... in each event)?
can any one answer to me????
MkhProgrammer
|
|
|
|