|
Hello
To see the differece with your eyes:
create a class and write to function one with the public and the Other with
shared.
you will find out, to use the first one you must create an instance of the class but to call the second one you dont need.
if you couldn't understand ( with my week English) I'll give you the class.
Good life.
|
|
|
|
|
Have got 1 datagrid displaying the data when the program is run and when i click on a selection in that datagrid it populates another datagrid 2 with the information required, say for instance i have to tables in database 1 shows-this datagrid 1 vb.net,and the other performances this datagrid 2 vb.net.
when i click the datagrid 1 it populates all the performances for that show into the other datagrid showing performance no,date,time,show no but i also need show title to come across but it is in another table shows datagrid 1. any ideas,
|
|
|
|
|
Hi Kendo,
If I understand correctly what you are asking, you can try something like this:
1. populate dataset 1 and bind it to datagrid 1
2. adapt the following code to get the row the user clicked on, and the corresponding cell value:
Private Sub Datagrid1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Datagrid1.MouseDown<br />
Try<br />
Dim myGrid As DataGrid = CType(sender, DataGrid)<br />
Dim hti As System.Windows.Forms.DataGrid.HitTestInfo<br />
hti = myGrid.HitTest(e.X, e.Y)<br />
Dim message As String = "You clicked "<br />
Select Case hti.Type<br />
Case System.Windows.Forms.DataGrid.HitTestType.None<br />
message &= "the background."<br />
Case System.Windows.Forms.DataGrid.HitTestType.Cell<br />
message &= "cell at row " & hti.Row & ", col " & hti.Column<br />
Case System.Windows.Forms.DataGrid.HitTestType.ColumnHeader<br />
message &= "the column header for column " & hti.Column<br />
Case System.Windows.Forms.DataGrid.HitTestType.RowHeader<br />
message &= "the row header for row " & hti.Row<br />
Case System.Windows.Forms.DataGrid.HitTestType.ColumnResize<br />
message &= "the column resizer for column " & hti.Column<br />
Case System.Windows.Forms.DataGrid.HitTestType.RowResize<br />
message &= "the row resizer for row " & hti.Row<br />
Case System.Windows.Forms.DataGrid.HitTestType.Caption<br />
message &= "the caption"<br />
Case System.Windows.Forms.DataGrid.HitTestType.ParentRows<br />
message &= "the parent row"<br />
MsgBox(message)<br />
End Select<br />
Catch Ex As Exception<br />
MsgBox(Ex.Message)<br />
End Try<br />
End Sub
3. Execute a parametrized query to populate dataset 2 with the data you want to show in datagrid 2, using the cell value obtained in the code above.
4. bind dataset 2 to datagrid 2
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi..
I am having a huge problem with getting the selected index changed property of a drop down list when inside a datagrid..
I have two drop down lists inside the datagrid, toSectDDL and tosubSectDDL. What i want is when the user selects an item from the toSectDDL, the tosubSectDDL should be populated with the related subsections for that particular section only..
I have written the VB code as
Protected Sub toSectDDL_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim row As DataGridItem
For Each row In SectionGrid.Items
Dim toSectDDL As DropDownList = CType(SectionGrid.FindControl("toSectDDL"), DropDownList)
Dim toSubSectDDL As DropDownList = CType(SectionGrid.FindControl("toSubSectDDL"), DropDownList)
If toSectDDL.SelectedValue = 0 Then
toSubSectDDL.Items.Insert(0, New ListItem("None", "0"))
Else
toSubSectDDL.DataSource = Office.GetSubSectionsForSection(toSectDDL.SelectedValue)
toSubSectDDL.DataTextField = "subsection"
toSubSectDDL.DataValueField = "subSecID"
toSubSectDDL.DataBind()
toSubSectDDL.Items.Insert(0, New ListItem("Select", "0"))
End If
Next
End Sub
and set the ASP code as
<asp:templatecolumn headertext="toSection">
<itemtemplate>
<asp:dropdownlist id="toSectDDL" runat="server" cssclass="standardDDL" width="402px" onselectedindexchanged="toSectDDL_SelectedIndexChanged" autopostback="True">
Now i am getting a server error saying
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
veyo.OfficeNameChange.toSectDDL_SelectedIndexChanged(Object sender, EventArgs e) in \\aion\intranetroot$\veyo\updateVEYO\OfficeNameChange.aspx.vb:430
System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +108
System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +26
System.Web.UI.Page.RaiseChangedEvents() +115
System.Web.UI.Page.ProcessRequestMain() +1099
Can anyone plz help!!!!!!
|
|
|
|
|
"<asp:TemplateColumn HeaderText="toSection"><ItemTemplate><asp:DropDownList id="toSectDDL" runat="server" CssClass="standardDDL" Width="402px" removed="toSectDDL_SelectedIndexChanged" AutoPostBack="True" ></asp:DropDownList></ItemTemplate></asp:TemplateColumn>"
I would first make sure you check the control for "If IsNothing" before doing anything manipulations to it. Also what is "removed="?
Cleako
|
|
|
|
|
Hello,
I want Copy a Folder & its sub Folder From CD Drive to My Documents. How i can do this ? and i also want to create short cut an exe file on Desktop from my Documents. I am using VB.NET 2005.
PLZ Help me.
Thanks & Regards
Form :-
Vikash Yadav
|
|
|
|
|
This may look a bit confusing, but it's it really easy.
Dim Path As String = "D:\"
For Each Directory As String In My.Computer.FileSystem.GetDirectories(Path, FileIO.SearchOption.SearchAllSubDirectories)
Dim DirName As String = Directory
Dim Pos As Integer = DirName.LastIndexOf("\")
DirName = Directory.Remove(0, Pos)
My.Computer.FileSystem.CopyDirectory(Directory, My.Computer.FileSystem.SpecialDirectories.MyDocuments & DirName, True)
Next
For Each File As String In My.Computer.FileSystem.GetFiles(Path, FileIO.SearchOption.SearchTopLevelOnly)
Dim FileName As String = File
Dim Pos As Integer = FileName.LastIndexOf("\")
FileName = File.Remove(0, Pos)
My.Computer.FileSystem.CopyFile(File, My.Computer.FileSystem.SpecialDirectories.MyDocuments & FileName, True)
Next
Hope this helps!
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
|
how to get the color of a pixel of an image in a pictureBox
Regards
Ramy
|
|
|
|
|
picturebox.Image.GetPixel should do it. But, if you really want to do anything with an image, you should draw it yourself, not use a picture box.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
This should do it:
Dim x As Integer = Me.PictureBox1.PointToClient(Windows.Forms.Cursor.Position).X
Dim y As Integer = Me.PictureBox1.PointToClient(Windows.Forms.Cursor.Position).Y
Dim col As Color = Img.GetPixel(x, y)
And please do not double post, at least, not until your post has gone to the next page, it's really annoying and hardly anyone had had a chance to answer your old one.
Posted by The ANZAC
|
|
|
|
|
hi
i have developed crstal report thro' VB. i want to print conditional headings & details
e.g. i have 2 manufacturing plants - Inline,Online
but my report is same for both plant but having 2 different headings & no. of machines in details. i have created such scrap database file according to the requiremets
for online heading is - "Rejection analysis for" - "Online"
for inline - "Rejection analysis for" - "Inline"
M/c no. for online - 1 2 3 4
M/c no. for inline -11 12 13
could it possible using formula field ? if possible the how ?
regads
reply immediate
thanks
|
|
|
|
|
I want format of date like dd/mm/yyyy in vb.net
& how will i get only separate time at that instant
reply immediate if possible
thanks
|
|
|
|
|
msgbox(now.tostring("dd/MM/yyyy"))
msgbox(now.tostring("hh:mm:ss"))
|
|
|
|
|
Hi EveryOne,
Guys I need to deploy a .net2005 project that includes crystal reporting of .net also. I need to know which neccessary files required to be added in .net setup project coz setup project picks only CrystalDecision. CrystalReports. Design.dll. Also guide me one more thing that Is Crystal Report setup for .net 2005 is also required to be run with setup coz another application of VB 6.0 running on same PC that is using Crystal Reports 9.0
Kindly give me any idea regarding these problems.
Regards
Ali Raza
|
|
|
|
|
Hello
how to retrieve the color of a pixel in a image inserted in a picturebox
I know that :
dim img1 as bitmap
(img1.GetPixel(e.Location.X, e.Location.Y).R
but im not able to use it within the Picturebox image
Regards
Ramy
|
|
|
|
|
Get the reference of the image from the control, cast it to Bitmap and use the GetPixel method.
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote: Get the reference of the image from the control, cast it to Bitmap and use the GetPixel method.
get u give me an example plz
Regards
Ramy
|
|
|
|
|
charchabil03 wrote:
get u give me an example plz
If you don't understand what I suggested, just say so. Then I can explain exactly what it is that you don't get.
If you don't tell me anything about why you think that an example would help, I can't write an example that would demonstrate what it is that you have problems with. What I suggested is really simple, and I could write the single line of code that does it, but if you don't understand anything about what I suggested, what do you think that you would understand from the code?
---
single minded; short sighted; long gone;
|
|
|
|
|
This should do it:
Dim x As Integer = Me.PictureBox1.PointToClient(Windows.Forms.Cursor.Position).X
Dim y As Integer = Me.PictureBox1.PointToClient(Windows.Forms.Cursor.Position).Y
Dim col As Color = Img.GetPixel(x, y)
Posted by The ANZAC
|
|
|
|
|
Hi,
I need to store the font in db and when get back again reflect the same font from DB.
For this I have used FontDialog to set font, How do I store it in DB and get back to set in the text box when needed?
Thanks in Advance.
Be simple and Be sample.
|
|
|
|
|
You can't store a Font object in a database. You have to save the properties of the Font you want, like FontFamily as a String, Size, Height, ..., enough information to recreate the font object when you read the data back from the database.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
How to use a AddressOf a Function with long type in an API. VB.Net return this error :"'AddressOf' expression cannot be converted to 'Long' because 'Long' is not a delegate type.". There are API and Function in under:
Public Declare Function EnumResourceNames Lib "kernel32" Alias "EnumResourceNamesA" (ByVal ghmodule As Long, ByVal lpType As ResType, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
------------------------------------------------------------------------------
Public Function EnumResNameProc(ByVal ghmodule As Long, ByVal lpszType As ResType, ByVal lpszName As Long, ByVal lParam As Long) As Long
Dim sNumber As String, IsNum As Boolean
If (lpszName > &HFFFF&) Or (lpszName < 0) Then
sNumber = PtrToVBString(lpszName)
IsNum = False
Else
sNumber = CStr(lpszName)
IsNum = True
End If
' 16x16
arIcon(SIZE_16, COLOR_4) = 296
arIcon(SIZE_16, COLOR_16) = 1384
arIcon(SIZE_16, COLOR_24) = 872
arIcon(SIZE_16, COLOR_32) = 1128
' 24x24
arIcon(SIZE_24, COLOR_4) = 488
arIcon(SIZE_24, COLOR_16) = 1736
arIcon(SIZE_24, COLOR_24) = 1864
arIcon(SIZE_24, COLOR_32) = 2440
' 32x32
arIcon(SIZE_32, COLOR_4) = 744
arIcon(SIZE_32, COLOR_16) = 2216
arIcon(SIZE_32, COLOR_24) = 3240
arIcon(SIZE_32, COLOR_32) = 4264
' 48x48
arIcon(SIZE_48, COLOR_4) = 1640
arIcon(SIZE_48, COLOR_16) = 3752
arIcon(SIZE_48, COLOR_24) = 7336
arIcon(SIZE_48, COLOR_32) = 9640
If IsNum Then
If lpszType = ResType.RT_ICON Then
LoadIconRes(lpszType, sNumber, giSize, giColorDepth)
End If
End If
EnumResNameProc = 1
End Function
Private Function PtrToVBString(ByVal lpszBuffer As Long) As String
Dim Buffer As String, LenBuffer As Long
LenBuffer = StrLen(lpszBuffer)
Buffer = String.Equals(LenBuffer + 1, 0)
StrCpy(Buffer, lpszBuffer)
PtrToVBString = Left(Buffer, LenBuffer)
End Function
------------------------------------------------------------------------------
For tRes = ResType.RT_FIRST To ResType.RT_LAST
Application.DoEvents()
EnumResourceNames(ghmodule, tRes, AddressOf EnumResNameProc, 0)
Next
Please help me!
|
|
|
|
|
You're trying to use old VB6 code in VB.NET. As you found out, you can't do that without some translation. You can't pass a pointer to a function under the .NET CLR like you could in the VB6 runtime. Since an object running under the .NET Framework can be moved at any time, a normal address passed to unmanaged code doesn't have any meaning.
You can find an example using the function you're looking at on P/Invoke[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I am having two controls in my form, I want to know programatically whether this control is set with BringToFront or not?
How do i get the value of controls BringToFront property value?
Rams.
Be simple and Be sample.
|
|
|
|