Click here to Skip to main content
16,012,843 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Here is the VB Code which is to be converted to C#....

VB
Function Display_Attachment_List(ActivityID as Integer) as String
    If AttachmentCollections.ContainsKey(ActivityID) Then
        Dim Attachments as HashTable
        Attachments = AttachmentCollections(ActivityID)

        Dim sb as New StringBuilder
        Dim this_entry as DictionaryEntry
        Dim this_attachment as HashTable

        sb.Append("<table cellspacing=0 cellpadding=2 width=100%>")

        For each this_entry in Attachments
            this_attachment = this_entry.value



And the C# converted code is as follows.......
C#
if (AttachmentCollections.ContainsKey(ActivityID))
    {
		Hashtable Attachments = default(Hashtable);
		Attachments = AttachmentsCollections[ActivityID];

		StringBuilder sb = new StringBuilder();
		DictionaryEntry this_entry = default(DictionaryEntry);
		Hashtable this_attachment = default(Hashtable);

		sb.Append("<table cellspacing="0" cellpadding="2" width="100%>");<br" mode="hold" />
		foreach ( this_entry in Attachments) {
			this_attachment = this_entry.value;
Posted
Updated 11-Jun-15 20:54pm
v2
Comments
Sascha Lefèvre 12-Jun-15 0:47am    
You posted an incomplete method. You didn't tell us the error message. You can edit your question by clicking the "Improve Question"-link below your question.
Ranju_test 12-Jun-15 1:16am    
the error is "The name 'AttachmentCollections' does not exist in current context"
DamithSL 12-Jun-15 1:26am    
you need to find where you define AttachmentCollections in your vb code

1 solution

You can always automatically translate between C# and VB.NET. Please see my past answer: Code Interpretation, C# to VB.NET[^].

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900