|
Marc Soleda wrote: Ok, that's right for a control but, if it isn't, and it's an object instanciated from a class library that after doing this cast doesn't have the Name property, how could I know it?
You can't, as it doesn't have a name.
What you are looking for is the name of the variable the holds the reference to the object. The problem is that there can be more than one variable referencing the object, or if there is a single variable, that variable might not have a name either, e.g. if it's part of an array.
---
Year happy = new Year(2007);
|
|
|
|
|
Guffa wrote: You can't, as it doesn't have a name.
That's the key! It doesn't have a name but I can compare two objects to know if they are the same instance that, for my purposes, is what I need: Object.ReferenceEquals
Thanks,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
You could also try:
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
Dim Ctrl As Control<br />
For Each Ctrl In Me.Controls<br />
If Ctrl.GetType Is sender.GetType Then MsgBox(Ctrl.Name.ToString)<br />
Next<br />
End Sub<br />
As a small concern, I would like to ask you this, are you sure that you are not trying to take efficient coding a bit too far?
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Johan Hakkesteegt wrote: As a small concern, I would like to ask you this, are you sure that you are not trying to take efficient coding a bit too far?
In this context maybe, but I want to export this to a class library made by me and it would help a lot if we could handle some events in this way.
Thanks,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Hi,
I dont know how to insert and retrive the image from the sqlserver2000 by using vb.net..im having the coding of c sharp.net but i dont know how to convert into vb.net, could anybody help me plz..
C sharp coding as follows for insertion and retrival...
private void BUpload_Click(object sender, System.EventArgs e)
{
// Create a byte[] from the input file
int len=FUpload.PostedFile.ContentLength;
byte[] pic = new byte[len];
FUpload.PostedFile.InputStream.Read(pic,0,len);
try
{
connection.Open ();
SqlCommand cmd = new SqlCommand ("insert into img "
+ "(bImg) values (@bImg)", connection);
cmd.Parameters.Add ("@bImg", pic);
cmd.ExecuteNonQuery ();
}
finally
{
connection.Close ();
}
}
==================
private void BShow_Click(object sender, System.EventArgs e)
{
MemoryStream stream = new MemoryStream ();
try
{
connection.Open ();
SqlCommand command = new
SqlCommand ("select bImg from img", connection);
byte[] image = (byte[]) command.ExecuteScalar ();
stream.Write (image, 0, image.Length);
Bitmap bitmap = new Bitmap (stream);
Response.ContentType = "image/jpeg";
bitmap.Save (Response.OutputStream, ImageFormat.Jpeg);
}
finally
{
connection.Close ();
stream.Close ();
}
}
=======================
i need this coding into vb.net help me plz......
regards
Kanna...
|
|
|
|
|
|
hi
i am working on vb.Net 2005,i want to import system.windows.input classes. i read on microsoft site that i have to reference presentationcore.dll in my application which is in Framework 3.0,i installed framework 3.0 but i am unable to find presentationcore.dll,if anyone have any idea so please help me.
Thanks
Thanks
|
|
|
|
|
i Need some help to generate an application which can generate BARCODE as an image..... i want to do it in VB.NET....
if any one have any idea about it..plz help me with this problem.....if u have any demo projects plz send it to this mail address
"abhilash.asokan@gmail.com"
|
|
|
|
|
Free Barcode Font - Code 39 - TrueType - Download
http://www.bizfonts.com/free
|
|
|
|
|
To get examples, type Barcode in the search field at the top of this page, if you can't find the answer there, chances are it can't be done.
"you can't forget something you never knew..." M. Du Toit
"Watching Migthy Joe Young made me hate my life..................................I want a gorilla!" A. Havemann
|
|
|
|
|
How would you get a message box to have a "Get Help" button that will open a document in the folder "Help" within the folder that the application is stored when you press it?
Also, I would like a custom icon as well (in the same location as the VS logo in this error below.)
Similar to this one
http://www.littlecatdevelopment.com/blog/vberror.JPG[^]
How would you create a custom message box as a library class so i could use it over again?
Any help would be nice
In the end we're all just the same
|
|
|
|
|
You would just create a brand new form, design it any way you like, and use it. You can put it in a dll if you want to, but that seems overkill.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
My DataTable has a VarChar field with no default value and it does not allow Nulls.
This DataTable is bound to my form using a BindingSource.
For some this reason when I do a BindingSource.EndEdit , that field is cleared, meaning the value the user entered into the textbox becomes cleared, and an exception is thrown stating that this field does not allow NULLS.
This makes absolutely NO sense, why would the EndEdit physically edit the value of one of my controls? And why change it to NULL if the field is required?
-- modified at 7:21 Thursday 1st February, 2007
"you can't forget something you never knew..." M. Du Toit
"Watching Migthy Joe Young made me hate my life..................................I want a gorilla!" A. Havemann
|
|
|
|
|
Hi all, I have a form in which I load a .rpt file, populate som values and then export it into a .PDF file. Something goes seriously wrong here thou.
All occurances of the letter t is replaced with ti or tt. All occurances of ti is being replaced
with tt. So for an example out of the file.
Should be Becomes after export to Adobe PDF
---------------------------------------------------------
Mattias Mattas
kommentarer kommentiarer
Deviation Deviatton
Skadat Skadatt
Registrerat Registirerati
I dunno why it does this. Has anyone else been out for it or am I alone in this matter?
Below is the "export" part of the code
<br />
CrystalReportViewer1.ReportSource = rptDocument<br />
<br />
<br />
Me.rtStatus.AppendText("Exporting to PDF" & vbCrLf)<br />
Application.DoEvents()<br />
<br />
Dim CryRepExportoptions As New CrystalDecisions.Shared.ExportOptions<br />
Dim CryRepDestination As New CrystalDecisions.Shared.DiskFileDestinationOptions<br />
Dim CryRepTypeOptions As New CrystalDecisions.Shared.PdfRtfWordFormatOptions<br />
<br />
CryRepDestination.DiskFileName = IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly.Location) + "\PDFTemp\" & Ticket.ToString & ".pdf"<br />
CryRepExportoptions = rptDocument.ExportOptions<br />
<br />
With CryRepExportoptions<br />
.ExportDestinationType = ExportDestinationType.DiskFile<br />
.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat<br />
.DestinationOptions = CryRepDestination<br />
.FormatOptions = CryRepTypeOptions<br />
End With<br />
<br />
rptDocument.Export()<br />
<br />
I'm completely clueless in this matter. Any help would be greatly appreciated.
|
|
|
|
|
hello,
i ve got a problem, where i have two asp pages say "A" and "B".
"A" and "B" are two differnet applications running on two different browsers on a same PC.
clicking a link on page "A" should check whether "B" is already running on that PC or not.
if yes then pass some parameter to page "B".
if no then create a new instance of page "B" in a new browser and pass parameters.
A help would be greatly appreciated.
Manas
|
|
|
|
|
Didn't you ask this using a different account the other day ?
You can't do it. A web browser cannot iterate over other browser instances that are running, it can't question them about where they are browsing. At least, not using javascript, AFAIK.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Probably you should look at opening a new window with a predefined name - this is all javascript:
var w = window.open("B" with params,"BWindow");
AFAIK, this will re-use the window with the same name if already open with the passed URL.
But remember that effectively, you are firing a new request to the server when you add the params.
Hope this helps.
Shreekar
|
|
|
|
|
That will obviously work, but I understood that he wants to find application B, no matter where it was previously opened from
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
OP wrote: i ve got a problem, where i have two asp pages say "A" and "B".
"A" and "B" are two differnet applications running on two different browsers on a same PC.
Based on the above, I surmised that the apps(pages) are running on the same PC. Still, I might be wrong in my understanding.
Shreekar
|
|
|
|
|
Hello,
I have a datagridView and I have a text box, I would like the user to enter some letter that will narrow the search down. For example in they type s as the first letter, it will find all the words that begin with s in a column in the datagridview. Moreover, if they type st then it will narrow all the words even further.
I am using typed dataset and have it bound to the datagridview.
I have done this in order versions of visual studio by passing a query using the like keyword. But in 2005 using typed datasets and datagridView is there a more automated way to do this.
Many thanks for any suggestions,
Steve
|
|
|
|
|
hi steve,
following code may help u.
' ''-------------------Selecting searchText
Private Sub txtSearchEname_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtSearch2.KeyPress
Dim strSearch As String
Dim i As Integer
If txtSearch2.Text = "" Then
Exit Sub
End If
strSearch = txtSearch2.Text
If Asc(e.KeyChar()) = 13 Then
For i = 0 To DgvEmpList.RowCount - 1
If (UCase(Trim(DgvEmpList.Item(2, i).Value)) Like "*" & (UCase(Trim(strSearch)))
& "*") Then
DgvEmpList.Rows(rowSelected).Selected = False
DgvEmpList.Rows(i).Selected = True
rowSelected = i
End If
Next
End If
End Sub
priya
|
|
|
|
|
Hello,
Thanks a for your answer.
A better method is to use the bindingsource and set the filer. e.g.
<br />
BindingSource1.Filter = string.format("{0} LIKE '{1}%'",me.cboSearchText.Text,me.txtSearch.text)<br />
This should be in the text changed event of the text box.
Steve
|
|
|
|
|
hii steve,
good code,
but will u thell Please, wht is cboSearchText?
& wht more i have to write for bindingSource?
Thanx.
--Regards Priya
priya
|
|
|
|
|
Hi Priya,
There are 2 methods using the datarowview of the bindingsource row filter property.
<br />
dim drv as datarowview<br />
drv = directcast(me.grdMyDataGrid,datasource, datarowview)<br />
drv.rowfilter = string.format("{0} LIKE '{1}'%", cboSearch.text, txtsearch.text)<br />
There is also another method where you can use the datasource default view property, there you can also set a filter.
If you need any more help, just reply to this i will give you more sample code,
Steve
|
|
|
|
|
(VS.net 2003) I need help with an application that launches certain events when the user presses certain keys/key combinations.
The only thing I can't do in this program is determine what keys/key combinations were pressed and if the certain key was pressed than i want to launch a certain event.
For instance if ctrl + Alt + C were pressed than the program would catch the key combination pressed and then launch a corresponding event.
Any help would be much appreciated. Thankyou!
|
|
|
|