|
I've seen that ( it's in the soapbox ), I just regard it as not worth involving myself in.
Christian Graus - C++ MVP
|
|
|
|
|
Christian Graus wrote: I just regard it as not worth involving myself in.
Smart guy
|
|
|
|
|
bapu2889 wrote: Dim Question(14), Ans1(14), WrongAns(14, 3), Clue(14), CorrectAns(14) As String
This is still so, so, totally wrong. You need to put your questions and answer into a struct, so that they are an atomic unit. I told you this before.
bapu2889 wrote: but other three answers are not but it shows three wrong answers but it's from other question
This is why I told you to put them together, I am not surprised.
Christian Graus - C++ MVP
|
|
|
|
|
Can anybody show me how to change the background of selected datagrid cells
Thanks
silver-gray
|
|
|
|
|
The answer you seek rests within the DataGridViewColumn.DefaultCellStyle.BackColor class. Enjoy!
Here's an example I wrote up:
For Each dgvc As DataGridViewColumn In dgvTableList.Columns
If dgvc.HeaderText = "name" Then
dgvc.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells
ElseIf dgvc.HeaderText = "crdate" Then
dgvc.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
dgvc.DefaultCellStyle.BackColor = Color.Aquamarine
Else
dgvc.Visible = False
End If
Next
Jonathan Sampson
www.SampsonResume.com
|
|
|
|
|
Is your reply for 2005?? I have 2003.
my 2003 does not know what this is "DataGridViewColumn"
What is the solution in 2003
Thanks
silver-gray
|
|
|
|
|
Um, I don't know what a .NET1.1 solution would be. Sorry.
For what it's worth, my VS2005 Intellisense doesn't pick up "DataGridViewColumn" either. I just ignore the intellisense and keep typing - the code works, but intellisense won't display "DataGridViewColumn" as a class under the namespace.
Jonathan Sampson
www.SampsonResume.com
|
|
|
|
|
WHAT DO YOU MEAN YOU IGNORE AND KEEP TYPING??
can you show me what it is you are typing ??
Thanks
silver-gray
|
|
|
|
|
Calm down, no need for caps - I'm trying to help you here
I coded this, and it worked as you requested.
For Each dgvc As DataGridViewColumn In dgvTableList.Columns
If dgvc.HeaderText = "name" Then
dgvc.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells
ElseIf dgvc.HeaderText = "crdate" Then
dgvc.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
dgvc.DefaultCellStyle.BackColor = Color.Aquamarine
Else
dgvc.Visible = False
End If
Next
If that code doesn't work for you, I'm unable to help you any further as I have no experience with .NET prior to the 2.0 Framework.
Jonathan Sampson
www.SampsonResume.com
|
|
|
|
|
hi there,
i am a newbie. i have seen applications that have one icon which you press to run it. the application contains data which it displays using a search engine. there are no visible data files, so either these files are hidden behind the icon or they are inside the executing file or something i don't know of as i am a newbie.
can a database reside within a .exe file?
how can i do the same? i've got my .exe file and database on the same level of the file hierarchy so i can use a relative path in order for my application to find the db file. it looks much more professional.
zank u
licec
|
|
|
|
|
Normally, you don't have a database in an .EXE unless it's a small one and you don't need to write anything to it.
The database could be in files on the drive, just not in the Program Files\Application folder. It could also be under Program Files\Common Files, or some other place.
If you're using an Access database, you can't put it in a resource in the .EXE. It MUST be in it's own file on the hard drive.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi, i have an application that has the filepaths stored in an access db. what i am having difficulty with is to send a picture to an existing .doc file containing text, which i then want to print.
thanx
licec
|
|
|
|
|
save the image temporary to the win-tmp dir an include it then with the inlineshape-object
myobject.Select
Selection.InlineShapes.AddPicture filename:=filename, LinkToFile:=False, SaveWithDocument:=True
|
|
|
|
|
Hi everyone, i know this is vb.net but i'm working in vb6 for the first time in ages and can't remember how to find the type of object contained in a variant in vb6
What i want to do is have a select case statement so that i can handle each type appropriately
thanks
Russ
|
|
|
|
|
having battled along without any vb help(myMSDN collection has no vb6 references in it) i just realised i could use the VB editor help in office and life is looking better.
TypeName works great, i've been using all sorts to no avail
Russell
|
|
|
|
|
Im tryin to create an add records button that interegates a panel controls in a form for its values so i can pass those values in an array to my entity class. Although I could set each value manually like in my example below, I have to perform the same task with 5 other panels on the form. The main problem that I have is I that i have 2 panels that contain combo boxes, and i cant obtain the values from them like i have my statement listed in the for loop. I had to manually set the values. Does anyone have any ideas???
Dim i As Integer
Dim field(dsDatabase.Tables(0).Columns.Count - 1) As String
Dim value(dsDatabase.Tables(0).Columns.Count - 1) As String
For i = 0 To dsDatabase.Tables(0).Columns.Count - 1
field(i) = dsDatabase.Tables(0).Columns(i).ColumnName
value(i) = pnlManageUsers.Controls.Item("txt" & field(i)).Text
Next
value(0) = txtMemberID.Text
value(1) = txtFirstName.Text
value(2) = txtLastName.Text
value(3) = txtAddressU.Text
value(4) = cboStateU.Items.Item(0)
value(5) = txtZipCodeU.Text
value(6) = txtPhoneNumberU.Text
|
|
|
|
|
you can make a collection of textboxes and add them to the form using controls.add
after this you can work with these text boxes using their index in the collection and you can make a loop
|
|
|
|
|
How do i detect a certain event from my event log in vb.net. Lets say an event like (eg Error in saving to DB)
|
|
|
|
|
Hi,
There is a walkthrough in the .NET studio documentation: "Walkthrough: Exploring Event Logs, Event Sources, and Entries"
If you don't have that, you might be able to find the same information on the microsof website.
Johan
|
|
|
|
|
i am making a function that validate control using for each controlname in me.control...next
where "me" is the name of the actual form using this i can validate my controls but not with the order tab that the controls have it, the control collection is taking the last control for biginin to validate.
And the other problen is that i have a control different of controlname used in de for statement for example a command button, it give me a error becose is validating it...
i need some help please!!!
Gbyte
|
|
|
|
|
I have the same problem.
My form has over 100 controls.
I would like to loop throught the controls in a particular order. Is this possible?
I can loop through the controls using [ me.Controls(i) ] but the default collection does not contain the controls in the order I require. This was easy using the index property in previous versions.
eg Loop through Label_01 to Label_23 then Label_45 to label_62. I could do this using a Case statement but think that this is not good style and may slow the application.
If you can help I would be thankful.
Hollywood_t
|
|
|
|
|
' Run once after the form is loaded and conrtols are created
Dim slControls as SortedList
Dim i as Integer
for i - 0 to me.controls.count - 1
'You may include a CASE or IF statement if you want to selectively add
slControls.add(me.controls(i).name, i)
next
'In your event handler for each control that changes
'that is of interest to you write sub routines for adding, removing
'sorting, etc.....
'*include appropriate code to filter those controls you need
'slControls.Remove(me.controls(i).name)
'slControls.Add(me.controls(i).name, Index)
'To retrieve a control's info simply loop through the array
for i = 0 to slControls.count - 1
slControls.GetKey(i) ' Returns the key - in this example's case - the NAME
slControls.GetbyIndex(i) ' Returns the value - in this example's case - the Order in the Collection
' Do your validation here using the values returned from the array slControls
next
'*** NB - code has been typed - please check for errors ***
Hollywood_t
|
|
|
|
|
I have problem with accessing arrays of strings.
Below is a VB.NET code of function StructToByteArray, which is modified version of http://www.codeproject.com/useritems/readwritestructstobinfile.asp
'This function copys the structure data into a byte()
Private Function StructToByteArray(ByVal strukt As Object) As Byte()
Try
Dim buffer(Marshal.SizeOf(strukt)) As Byte
'Allocate the buffer to memory and pin it so that GC cannot use the space (Disable GC)
Dim h As GCHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned)
'copy the struct into int byte() mem alloc
Marshal.StructureToPtr(strukt, h.AddrOfPinnedObject(), False)
h.Free() 'Allow GC to do its job
Return buffer ' return the byte(). After all thats why we are here right.
Catch ex As Exception
BladPokaz(ex)
Return Nothing
End Try
End Function
And here are the sample structure:
<StructLayout(LayoutKind.Sequential, Pack:=1)> _
Private Structure Str1
Friend dintVal As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> _
Friend dintArr() As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=6)> _
Friend stringVal As String
End Structure
What we've got here is Integer value, array of Integer values and a String value.
The problem is how to define an array of Strings. The size of array
and size of String could be fixed.
I've tried other array types (SafeArray, ByValTStr, etc.) and define ArraySubType.
None of this worked for me.
Thanks in advance for your help.
Marc
|
|
|
|
|
Hi Marc,
If I understand the question correctly, the answer is simple:
<br />
Dim NumberOfElements as Integer<br />
NumberOfElements = 4 'for example<br />
Dim MyStringArray(NumberOfElements) as string 'Gives you an array, with 5 empty elements<br />
MyStringArray.SetValue("Hello", 0)<br />
MyStringArray.SetValue(" ", 1)<br />
MyStringArray.SetValue("World", 2)<br />
MyStringArray.SetValue("!", 3)<br />
'etc<br />
In other words, determine how many elements will be in your array, and then fill them up any which way you like.
Hope this helps you,
Johan
|
|
|
|
|
I want to have a structure like this:
<StructLayout(LayoutKind.Sequential, Pack:=1)> _
Private Structure Str1
Friend dintVal As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> _
Friend dintArr() As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=6)> _
Friend stringVal As String
<MarshalAs(UnmanagedType.ByValArray)> _
Friend stringArr as String()
End Structure
I don't know how to properly declare array of Strings, and its size,
inside above structure.
Now, look at the StructToByteArray function from my previous post.
When I had debugged its code I've noticed, that size of buffer
isn't calculating corectly.
Here is example of how I fill an instance of my structure (but it's typical):
Private struk1 As Str1
struk1.intVal = 25
struk1.bVal = True
ReDim struk1.stringArr(1)
struk1.stringArr.SetValue("here is text1", 0)
struk1.stringArr.SetValue("and here is text2", 1)
Marc
|
|
|
|