|
I have unsubscribed to all events.
It's the same situation.
|
|
|
|
|
Does there still exist another form that is "hidden", instead of closed?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
no , all the forms are closed , and I repeat that if I open the same form , but without creating the combobox , everything works ok.
|
|
|
|
|
Did you consider my suggestion to post your code?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Please , can you make more clear what is the code that you want ?
on my main form Menuitem that close the application , I have only :
Application.Exit
On the form where I use the combobox , on the close event I have only the code that unsubscribe from all event and Combobox.dispose.
|
|
|
|
|
.
modified 18-May-15 1:50am.
|
|
|
|
|
|
Emm, thanks. The problem is I'm on a level where copying text from one textbox to another by usign a button is quite an achievement and analysing somebody else's project isn't something I could benefit from right now.
|
|
|
|
|
Hi.. I just made a vb.net project. My problem is that, how can i automatically resize the image size (height and width) when inserting in a picturebox? For example, the image i have on my picturebox is 128x128. Now, before i save that image to my sql database, i want the image size to become 100x100... How to do that? Please, i need your help... Thanks...
|
|
|
|
|
Give your picturebox the size of 100x100 and set it to "zoom". See MSDN[^] for details.
The easy way;
Dim resizedBitmap As Bitmap = New Bitmap(originalImage, new Size(100, 100));
If you need more control over the quality of the result, try the answer by Mark[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
modified 17-May-15 12:40pm.
|
|
|
|
|
That only displays the bitmap in the new size. OP is asking how to actually resize the bitmap.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
You're right; I did not read as carefully as I should have
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I'm attempting to draw a small rectangle in the top right corner of a dgv control. I'm very new to this and haven't managed to paint anything in the cell at all yet. I'm told a custom cell or column is needed, but am stuck creating one. Any help much appreciated
|
|
|
|
|
You don't need to create a custom cell or column. You'd need a DGV (with data!) and to implement one of the paint-handlers;
class Program
{
static void Main(string[] args)
{
using (var f = new Form())
{
var dgv = new DataGridView() { Dock = DockStyle.Fill };
dgv.Columns.Add(new DataGridViewTextBoxColumn());
dgv.CellPainting += dgv_CellPainting;
for (int i = 0; i < 5; i++)
dgv.Rows.Add(new[] { Guid.NewGuid().ToString() });
f.Controls.Add(dgv);
f.ShowDialog();
}
}
static readonly Size rectSize = new Size(10, 10);
static void dgv_CellPainting(
object sender,
DataGridViewCellPaintingEventArgs e)
{
e.Handled = false;
if (0 == e.ColumnIndex)
{
if (-1 == e.RowIndex)
return;
e.PaintBackground(
e.CellBounds,
DataGridViewElementStates.Selected == e.State);
e.PaintContent(e.ClipBounds);
e.Graphics.FillRectangle(
Brushes.Red,
new Rectangle(e.CellBounds.Location, rectSize));
e.Handled = true;
}
}
}
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks for that. Will give it a tryout asap but that code con vertor link just says "Thanks! We're now processing your upload" for ever.
|
|
|
|
|
Hi,
The first method only sets up a grid, and hooks up the paint-event. The second method would roughly translate to the code below;
Shared ReadOnly rectSize As New Size(10, 10)
Private Shared Sub dgv_CellPainting(sender As Object, e As DataGridViewCellPaintingEventArgs)
e.Handled = False
If 0 = e.ColumnIndex Then
If -1 = e.RowIndex Then
Return
End If
e.PaintBackground(e.CellBounds, DataGridViewElementStates.Selected = e.State)
e.PaintContent(e.ClipBounds)
e.Graphics.FillRectangle(Brushes.Red, New Rectangle(e.CellBounds.Location, rectSize))
e.Handled = True
End If
End Sub
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Wow, thank you! That is mighty impressive With a bit of fiddling i got the required triangle shape.
[code]
e.Handled = False
If 0 = e.ColumnIndex Then
If -1 = e.RowIndex Then
Return
End If
e.PaintBackground(e.CellBounds, DataGridViewElementStates.Selected = e.State)
e.PaintContent(e.ClipBounds)
Dim x1 As Integer = e.CellBounds.Right
Dim y1 As Integer = e.CellBounds.Top
Dim x2 As Integer = x1 - 7
Dim y2 As Integer = y1
Dim y3 As Integer = y1 + 7
Dim x3 As Integer = x1
e.Graphics.FillPolygon(Brushes.Red, {New Point(x1, y1), New Point(x2, y2), New Point(x3, y3)})
e.Handled = True
End If
[/code]
However 2 things to ask please. How do is set which column the shape is in and when clicked
the text forecolor changes to white (until released). Can that forecolor not change ?
|
|
|
|
|
You're welcome
Helium99 wrote: How do is set which column the shape is in The event-handler is executed for each cell; we check in the handler whether we're in the first column, and if so, then paint. That's done by the line below;
If 0 = e.ColumnIndex Then Would have been more readable if it said "If e.ColumnIndex = 0 Then". Change the 0 to a 1 to have it appear in the second column.
Helium99 wrote: when clicked the text forecolor changes to white (until released). Can that
forecolor not change That might be the "highlight" color that has been set, but I'm not sure.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
This code is working properly
DataEnvironment1.Commands("Command1 ").CommandType = adCmdText
DataEnvironment1.Commands("Command1 ").CommandText = "Select * from TenderBlocksCalcolations where ProjectsCode = '" & txtProjectCode.Text & "'"
But when i make grouping its not works
DataEnvironment1.Commands("Command1_Grouping").CommandType = adCmdText
DataEnvironment1.Commands("Command1_Grouping").CommandText = "Select * from TenderBlocksCalcolations where ProjectsCode = '" & txtProjectCode.Text & "'"
Can you give any idea?
|
|
|
|
|
Yeah, you don't have any GROUP BY clause in your SQL statement.
You might want to read up on it here[^].
|
|
|
|
|
My purpose is to identify a specific USB device which, once installed via its driver, will go under the COM Port devices, appearing with a speficic name and a specific GUID Class ID will be defined for it as well.
If I want to access this device, is there a way for detecting which COM port has been assigned by Windows? If yes, it would be possible to automatically attach to it without asking the user to check and then select the right COM port.
SepPax
modified 16-May-15 11:52am.
|
|
|
|
|
|
The example you posted will return the COM Port names (COM1, COM2, COMx...).
My need is different.
Assume to have a USB device named "USB Dev" connected to COM7.
What I want to achieve is finding out on which COM port the device 'USB Dev' is connected, therefor locate it via its name.
Possible?
SepPax
modified 13-May-15 18:38pm.
|
|
|
|
|
Use the suggestion, write the code, report the results.
Then, if it doesn't work, ask for further assistance.
|
|
|
|
|
Works well with name search
Dim port as string
Dim device as string
Try
Using searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_SerialPort")
For Each queryObj As ManagementObject In searcher.Get()
port = queryObj("DeviceID")
device = queryObj("Description")
Next
End Using
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
End Try
check device for what you look for.
SepPax
|
|
|
|