|
use
shared s1 as string
and then in form2_load
sub1.Text=objForm1.s1
Note:
objForm1 should be Globally visible inorder to access it in form2's object
or
You can declare
shared objForm1 as New Form1()
|
|
|
|
|
I am trying to drag a metafile (.wmf) from eg. ms word into a vb 2005 app. When it is dropped on a diagramming control, I want to set the image of an object I create to the dropped image.
The dropped object has loads of DataFormats available, this works fine:
Dim bm As Bitmap = e.Data.GetData(DataFormats.Bitmap)
but now the image is a bitmap, no longer a vector graphic.
'Getting' a MetafilePict object somehow always returns a MemoryStream object, so I thought I had it cracked by using:
Dim ms As IO.Stream
ms = e.Data.GetData("MetafilePict", True)
Dim img As Image = Imaging.Metafile.FromStream(ms, True, True)
But this just generates an 'Invalid Parameter' error. Any ideas here would be much appreciated
|
|
|
|
|
I want to download free transparent bitmaps (images for menu, and toolbar for a small word processing application.)
Can you show me a link?
transparent bitmap = a bitmap which has a transparent background
chatura
|
|
|
|
|
Hi all,
I really need to convert the C# code below into VB. If possible can advise me where is the most approriate place to place this portion of code. The code is to wire the parent datagrid for the ItemCreated event and ItemDataBound event.
Please help me.
private void InitializeComponent()<br />
{<br />
this.load += new System.EventHandler(this.Page_Load);<br />
this.dgRegion.ItemCreated += new DataGridItemEventHandler(dgRegion_ItemCreated);<br />
this.dgRegion.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dgRegion_ItemDataBound);<br />
}
Thanks in advance,
Chiari
|
|
|
|
|
Private Sub InitializeComponent()
Me.load += New System.EventHandler(Me.Page_Load)
Me.dgRegion.ItemCreated += New DataGridItemEventHandler(dgRegion_ItemCreated)
Me.dgRegion.ItemDataBound += New System.Web.UI.WebControls.DataGridItemEventHandler(Me.dgRegion_ItemDataBound)
End Sub
http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx
Jereme Watts
|
|
|
|
|
Hi Watt,
Thanks for conversion. However I can't use these codes. It gave me errors. Please advise.
Thanks in advance,
Chiari
|
|
|
|
|
the below coding for read text from .txt files. i need to read from .doc file. this code is giving unknown chars. any body can solve this problem?
Dim filetoread As String
Dim filename As String = Trim(TextBox1.Text)
filetoread = Server.MapPath(filename)
Dim sr As StreamReader
sr = New StreamReader(filetoread)
Label1.Text = sr.ReadToEnd()
sr.Close()
|
|
|
|
|
Don't cross post. Don't spam the forum with the same question over and over.
Instead, follow up on the answers you got when you asked the same question before:
http://www.codeproject.com/script/comments/forums.asp?forumid=12076&tid=1373042&select=1373042#xx1373042xx
---
b { font-weight: normal; }
|
|
|
|
|
hey guys,
I m using 1 windows application & 1 web application in a solution. i WANT TO ACCESS VARIABLES OF web appln in windows appln. Can Anybody help me by telling how to do it? Thanks for your help.
|
|
|
|
|
You can't. The web application runs in an entirely different process from the Windows app. On top of that, the Web app is only running during the execution of a web request. It doesn't run all the time like a Windows Forms app.
You'd have to save the values in a common object, like a file, database, or a remote Singleton object. But since the web app has the ability to respond to many requests at the same time, concurrency issues will be plentifull, no matter which route you take.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 10:08 Tuesday 21st February, 2006
|
|
|
|
|
Hey guys,
This is some information which I have been reading on many websites regarding datasets.
A dataset is the local repository of the data used to store the tables and disconnected record set. When using disconnected architecture, all the updates are made locally to dataset and then the updates are performed to the database as a batch.
Please refer to the words that I have marked as bold. Can anyone tell me how that is done. I am a fresher in .NET. I really think that the execution speed of my application suffers since I update each record individually. I want to know how I can add/modify/delete to a dataset and then update the changes to the database.
With Best Regards,
Mayur
|
|
|
|
|
Here are two funtions for Access.
<br />
Private Sub Do_Some_Work()<br />
<br />
Dim dt as DataTable<br />
<br />
FillTable(dt,"SELECT * FROM TableName")<br />
'<br />
'Modify the table <br />
'<br />
UpdateTable(dt,"SELECT * FROM TableName")<br />
<br />
End Sub<br />
<br />
Public Function FillTable(ByRef dt As DataTable, ByVal SelectString As String) As Boolean<br />
Dim path As String = Application.StartupPath<br />
Dim cnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _<br />
& " Data source= " & path & "\MyDB.mdb"<br />
Dim strSelect As String = SelectString<br />
'& ";Connect Timeout=10"<br />
Dim cn As New OleDb.OleDbConnection(cnStr)<br />
Dim cmd As New OleDb.OleDbCommand(strSelect, cn)<br />
Dim da As New OleDb.OleDbDataAdapter(cmd)<br />
cmd.CommandTimeout = 5<br />
Try<br />
da.FillSchema(dt, SchemaType.Source)<br />
da.Fill(dt)<br />
Return True<br />
Catch ex As Exception<br />
Messagebox.Show(ex.Message)<br />
Return False<br />
Finally<br />
cn.Close()<br />
End Try<br />
End Function<br />
<br />
Public Function UpdateTable(ByVal dt As DataTable, ByVal strSelect As String) As Boolean<br />
Dim path As String = Application.StartupPath<br />
Dim cnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _<br />
& " Data source= " & path & "\MyDB.mdb"<br />
'& ";Connect Timeout=10"<br />
Dim cn As New OleDb.OleDbConnection(cnStr)<br />
Dim cmd As New OleDb.OleDbCommand(strSelect, cn)<br />
Dim da As New OleDb.OleDbDataAdapter(cmd)<br />
Dim cb As New OleDb.OleDbCommandBuilder(da)<br />
cmd.CommandTimeout = 5<br />
Try<br />
cb.GetUpdateCommand()<br />
da.Update(dt)<br />
Return True<br />
Catch ex As Exception<br />
Messagebox.Show(ex.Message)<br />
Return False<br />
Finally<br />
cn.Close()<br />
End Try<br />
<br />
End Function
|
|
|
|
|
When you use a DataSet, or DataTable, with a DataAdapter object, you supply the DataAdapter with the SELECT statement to fill the DataSet. Your user makes any required changes to the data, then tells your app to update the database.
This is where I think you're duplicating the functionality of the DataAdapter. The DataAdapter also needs the appropriate SQL commands for UPDATE, INSERT, and DELETE operations on the data it retrieved using the SELECT command. When the dirty data is written back to the database, the DataAdapter looks at each recond in the DataSet/DataTable and, using a flag attached to each record, decides which of those SQL commands to execute for that record, if any.
You may be doing the same thing, or something similar. But, in any case, you're probably duplicating the functionality of the DataAdapter.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all
I have developed an application that runs on the Terminal Server. I want to determine the connecting client's IP address and subnet mask to assign them appropriate rights.
I have used the wtsclientinfo.dll to get the client's IP address. But I could n't find a way to get the subnet mak. Can anybody help me?
samitha
-- modified at 23:50 Monday 20th February, 2006
|
|
|
|
|
samitha,
wtsclientinfo.dll is a wrapper for wtsapi32.dll by Jitendra Kumar, (you should get with him) about that.
But regardless, wtsapi32 microsoft documentation for WTS_CLIENT_ADDRESS, which is called by his wrapper has some remarks you may be interested in first:
MSDN Remarks:
The client network address is reported by the RDP client itself when it connects to the server. This could be different than the address that actually connected to the server. For example, suppose there is a NAT between the client and the server. The client can report its own IP address, but the IP address that actually connects to the server is the NAT address. For VPN connections, the IP address might not be discoverable by the client. If it cannot be discovered, the client can report the only IP address it has, which may be the ISP assigned address. Because the address may not be the actual network address, it should not be used as a form of client authentication.
Reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/termserv/termserv/wts_client_address_str.asp[^]
progload
|
|
|
|
|
Great catch! A fine example of how reading the documentation on what your using can save you from wasting a lot of time.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
NAT won't be a problem. Can anybody suggest me a method to find the client's subnet mask giving its IP Address?
samitha
|
|
|
|
|
Hello, Everyone
Heres my problem, I have a binary search tree with 100 randmon elements in it. I have gotten that down, but can anyone give me some help on to how to get a count of those random number as they are entered into the tree. heres the code i am using
For index = 0 To 100
Nums.insert(CStr(Int(Rnd() * 100)))
Next
|
|
|
|
|
Create the random number. Then write code to record the frequency of each number. Insert the number into the binary tree.
|
|
|
|
|
Hi everyone
Could you please help me?
I would like to know the length of Two Dimension Array.
Example :
Dim arr(2)() as string
Dim LenRank2 as Integer
Dim i as int32
For i=0 to 10
arr(1)(i)=i.ToString
arr(2)(i)=i.ToString
Next
LenRank2 = arr.GetLength(1)
I got the error message
"Index was outside the bounds of the array."
I want to get the length of second dimension.
What's wrong?
Thank in advance.
!alien!
|
|
|
|
|
The error message is because of the first dimension.
In VB: If you declare as arr(2), the index will start from 0.
ie. arr(0) and arr(1)
If you want to use arr(1) and arr(2), declare as arr(1 to 2)
|
|
|
|
|
Thank you for your reply. Have a nice day.
!alien!
|
|
|
|
|
You can get the length of the inner arrays by calling Length(). Just like how you would do it with the outer array.
Dim myArray()() As Integer = {New Integer() {1, 2, 3, 4}, _
New Integer() {1, 2}, _
New Integer() {1}}
For index As Integer = 0 To (myArray.Length - 1) Step 1
MessageBox.Show(myArray(index).Length.ToString)
Next
The output above will be "4", "2", and "1".
|
|
|
|
|
How do you code passing of parameters from a VB form to a crystal report.
Ex : There is a textbox called "name" I need the value of that box (name.text) to be displayed in the crystal report
AMIF
|
|
|
|
|
Hi,
How do we make a listbox to respond directly when the user clicks on the items in the textbox? (such as making a menu appear or displaying info in a label when the items are clicked)
I have used the SelectedIndexChange event but nothing happens when the listbox items are clicked. The SelectedIndexChange event only seems to work when a button is added. It seems that the button's click event gets the listbox's selectedindex change event to start working. The listbox's textchanged event doesnt seem to work also.
Is there any way to make the listbox respond directly to the user's clicks without the use of button controls?
|
|
|
|