Create An Extension For Linq2sql?

Dec 22, 2009

I have this one line property

Public ReadOnly Property DateToUniversal(ByVal dt As Nullable(Of Date)) As String
Get
Return If(dt.HasValue, dt.Value.ToString("u").Substring(0, 10), "")

[code].....

View 1 Replies


ADVERTISEMENT

VB 2010 How To Create Own Extension

Dec 4, 2011

1. my program to be the default program for this extension2. when I open the file, I want it to make specific things in the program window3. the things that the file did, I want to be remembered next time I open the program.I want my program to have a better look, so I decided to make Theme Packs for it, and post them on program's website. That's why I want a code for all these things.

View 6 Replies

Create A File Extension For My Applicaton?

Sep 7, 2011

I have a profile program, were you enter in your personal data such as name, address, phone, company, website, ect, then when you save it, it saves to a file extension like *.pdt, then I can open the file with the extension *.pdt, and all the text fields saved in the *.pdt appear in there correct text fields.

View 2 Replies

How To Create Extension To Shared Method

Jul 24, 2011

I like to create an extension method to Image.FromStream Public Shared Function FromStream(ByVal stream As System.IO.Stream) As System.Drawing.Image

With possibility to cancel processing like Public Shared Function FromStream(ByVal stream As System.IO.Stream, ByVal CloseTask As ManualResetEvent) As System.Drawing.Image

View 1 Replies

VS 2008 - How To Create File Extension On PC

Jul 1, 2009

I found out how to create file extensions on my PC and I want to open my program with the file extension, but how would I be able to load the text in the file extension into a textbox on my form if that's what the extension is for? And another question, how could I make a file extension that would act like a folder? Like store images and sound files and things like that.

View 9 Replies

Asp.net - Can Linq2sql Do This Without A Lot Of Custom Code?

Jan 13, 2009

how to make linq2sql behave like my custom code used to, I want to check to make sure that it isn't already "built" in behavior that I can just use by setting up the relationships right in the designer...

Very simple example: I have two tables: Person and Notes, with a 1 to many relationship (1 Person, many notes), linked by Person.ID->Note.PersonID.

I have a stored procedure (all data access is done via SP's and I plan on continuing that) which makes the Link2SQL a bit more work for me.

sp_PersonGet(@ID int) which returns the person record and sp_PersonNotesGet(@PersonID) which returns a set of related notes for this person.So far so good, I have an object:

Dim myPerson As Person = db.PersonGet(pnID).Single

and I can access my fields: myPerson.Name, myPerson.Phone etc.and I can also do a

Dim myNotes As Notes = db.PersonNotesGet(pnID)

to get a set of notes and I can iterate thru this list like:

For Each N As Note In myNotes
( do something)
Next[code].....

Basically, Linq2SQl would need to call 2 stored procedures each time a Person record is created...Is this doable "out of the box", or is this something I need to code around for myself?

View 3 Replies

Cystal Reports With Linq2Sql?

Feb 25, 2010

I want to use Linq2Sql as the data source for my Crystal reports. I have all my data in my domain objects in the form of Lists. The problem is all my domain model resides in a different namespace in the form of a .dll. And when i try to assign a data source for my report in Database Expert window, under .NET Objects, i can only see classes that are available in the current project and not from other projects in my solution, nor from other namespaces.

View 1 Replies

Linq2SQL Counts Getting Cached?

Sep 23, 2009

I've got a very simple data structure. I'm using SQLExpress with Linq2SQL and vb.net

**ParentClass**
parentId
name

[code].....

View 1 Replies

Class - Create Extension As DataTable(Index)

Dec 30, 2011

I have a question related with VB.Net Code. I see that the DataTable we can use: DataTable(0)'This return a DataRow with the selected index In the intellisense I see that this functionality can achieve with a extension... but, If I create a extension, always I need refer the Extension before to use it

[Code]...

View 1 Replies

VS 2008 Create A Compressed File With Own Extension?

Nov 18, 2009

I don't really know how to use compression in VB.net, so I was wondering if someone could explain it to me. I'm also wondering if it is possible to create a compressed file with your own extension.

View 13 Replies

.net - Linq2sql Synchronized Rapid Deletes?

May 7, 2011

I set up a test harness by checking for and then deleting records added to the db in the previous testing session, and then I test my recording adding code by adding back the same records.Interestingly this code works fine when there is a break in the debugger, but fails with a "duplicate key" exception when I let it run with no breaks, which leads me to believe there is some kind of concurrency issue.The basic metacode is as follows:

DoTest()
dim j as datacontext
dim recs = from myrecs in j.mythings select myrecs where myrecs.key="key1" or
myrecs.key = "key2"

[code]....

I've confirmed that I'm properly deleted the previous added records, and this works fine as does adding the new records when I have a break in the code before I hit the add records step. but without the break, it throws duplicate key exceptions in the "addrecordestomytable" method suggesting that it hasn't grabbed the current version of the table when it creates the new data context in addrecordstomytable, even though the records should have already been deleted.I've tried refreshing the table, but this doesn't seem to work either.Note backing database is ms sql server 10?

View 1 Replies

Linq2sql Synchronized Rapid Udeletes?

Oct 4, 2011

I set up a test harness by checking for and then deleting records added to the db in the previous testing session, and then I test my recording adding code by adding back the same records.Interestingly this code works fine when there is a break in the debugger, but fails with a "duplicate key" exception when I let it run with no breaks, which leads me to believe there is some kind of concurrency issue

View 1 Replies

VS 2010 LINQ2SQL - How To Add Conditions Runtime

Jun 20, 2012

[Code]...

How to create a LINQ query that allows the end user to choose a few months?

View 1 Replies

Adding An Empty Row To A Databound Listbox Using Linq2SQL And Winforms?

Sep 28, 2011

what is the most robust method for adding a empty row (to select "nothing") to a ListBox?

Dim List = Enumerable.Repeat(New TABLE With {.Text = "", .ID = -1}, 1).AsQueryable().Union(From t In mainctx.TABLEs)
ddlMangelKategorie.DisplayMember = "Text"
ddlMangelKategorie.ValueMember = "ID"
ddlMangelKategorie.DataSource = List.ToList

But this has some drawbacks:wordy must explicit write the Type (TABLE in this case), so i cant wrap this in a function have not found an solution, which works with anonymous types I.e. if I add a From t In mainctx.TABLEs Select Text=col1, id=col2 to the query, this method does not work anymore.

View 1 Replies

Use An Extension Method Instead Of Just Creating Non-extension Sub Or Function?

Dec 3, 2009

Why would I use an extension method instead of just creating non-extension sub or function?

For ex, I could have an extension function called IsNullOrEmptyOrAllSpaces on String, which does a check as its name implies. Or I can write a stand alone function that does the same thing. Other than having the extension show up in Intellisense, is there any advantage? Is a call to the extension quicker/more efficient than a call to a regular function?

View 8 Replies

VB Extension Property Instead Of Extension Method

Mar 16, 2012

I saw this post and I want to know if this is possible in VB. So like extension method, do extension properties exists in VB.Net? Here I've read they do, but cannot find any examples.

View 3 Replies

VS 2008 Hide Extension When It's Not Used As An Extension?

Dec 9, 2011

If i have an extension ... say...

vb
<System.Runtime.CompilerServices.Extension()> _
Public Sub Invert(ByVal b As Bitmap)

is there any way of hiding this from inteli-sense if it is not used as an extension?so that pressing ctl+space only triggers it if you go "bitmap.Inve.." rather than prompting on "Inve..."?

View 2 Replies

.net - Create A Generic IsEmpty Extension - Output Is "False"?

Jul 21, 2011

I'm trying to create a generic IsEmpty extension but am having problems specifically with dictionaries: The functions I have created:

<Extension()> Function IsEmpty(null As DBNull) As Boolean
Return True
End Function[code].....

For my purposes, booleans and numerics are never "empty".The problem is that dictionaries are using the generic (Of T)(val As T) function instead of the (collection As ICollection) function.

i.e.

Dim dict As New Dictionary(Of String,String)
Response.Write(dict.IsEmpty)

output is "False"

I tried using (Of K,V)(collection As ICollection(Of KeyValuePair(Of K,V))) to no avail.What am I doing wrong?

View 3 Replies

Asp.net - .Net Iniatialising A Class Using System.Reflection And System.Type To Create A Session Based Singlton Extension Method

Jun 11, 2009

I have had several occasions recently to access a specific class several times over a relatively small time frame.So I've been storing the value of the class in Session and trying to access it on page load, if it's not available creating a new instance and storing that in session.

So instead of constantly replicating the same code for different classes on different pages I'm trying to create an extension method to do this for me.

[Code]...

I'm stuck on what to do when I make my new instance of my class (it would have to have a New() sub)

I'm not sure where to go from here... or even if this is the best way to do it.

View 2 Replies

Create A Custom File Association ( A Custom Extension ) In VB?

Dec 19, 2010

know how to create a custom file association ( a custom extension ) in VB .Net and how to open it on the application

View 1 Replies

File I/O And Registry :: Create New File Extension?

Sep 8, 2009

i want to create a new file extension like, .newprog file.and i want it to be able to get back by opendialogbox. i want it to store the control of my form that will be at different place on the form.

View 1 Replies

Getting An Other File Extension As Default Instead Of All Files As Default Extension?

Jun 25, 2009

I am using VB 08 running an openfiledialogue wanting to get the result of the GDS file (*.gds) to be the default extension at the drop down menu instead of All file when the openfiledialogue box opens.

I coded it with:

OpenFileDialogue.Filter = "GDS File(*.gds)|*.gds|All files|*.*"

but the results i get in the open file dialogue box remains as all files being in the drop down menu as the default file extension. How to i set it to ".gds" format?

View 1 Replies

Get Any File Of Extension?

Jul 22, 2011

Using the below code I want to set the '*' to any file. This folder (C:ewtemp) will only have one TIF file in it at a time so I want it to use that file as TextBox1, but that filename is dynamic, but always with extension .TIF.

TextBox1 = Convert.ToBase64String(StreamFile("C:
ewtemp" * ".TIF"))

Know how to do that?

View 7 Replies

.net - Extension And CodeDomProvider

Jul 24, 2011

I am having problems with CodeDomProvider. When I compile a code VB, there is not an error. But, if this code has extensions (ex: string().contains(), char().count, char().AsEnumerable, etc.) at the moment that I call these functions, it's returns an exception equal for all these extensions:

'Public Member 'Count' at type 'Char()' not found'

'Public Member 'Contains' at type 'String()' not found'

Dim refs() As String =

[CODE]...

These are the Assembly that is referenced to the compile, and this is also configurated for run in Framework 4.0.

Dim Param As New Dictionary(Of String, String)

Param.Add("CompilerVersion", "v4.0")

Dim oCodeProvider = CodeDomProvider.CreateProvider("VisualBasic", Param)

This code is inside a string:

Imports System
Imports System.Xml
Imports System.Data

[CODE]...

After I use it for compile my Assembly. The code compiles without errors, but when I call the function 'ProcessarLink', it returns me the exception in 'Contains', or when I call the function 'Personalizar' the errors appears with the 'Count'. This happens with the others extensions too, like AsEnumerable, etc.

View 1 Replies

.net - Extension Methods In T4?

Mar 28, 2012

I'm trying to use PGK.Extensions in a T4 template in VS2008 for VB.NET and I get:

RemoveAllSpecialCharacters is not a member of string..

My T4 headers:

<#@ template language="VB" hostspecific="false" debug="true" inherits="Microsoft.VisualStudio.TextTemplating.VSHost.ModelingTextTransformation" #>
<#@ output extension="vb" #>
<#@ assembly name="PGK.Extensions.dll" #> // the dll is found
<#@ import namespace="StringExtensions" #> //Try with and without namespace

[Code]...

View 1 Replies

C# :: Get Image With Its Name And Any Extension?

Mar 18, 2009

I am building an asp.net website. I want to show image on the page, but while I know the image name, I don't know the extension.So, I want to open the images directory and get the image by its name whatever its extension.

View 2 Replies

C++ - Tcl Extension Calling A .NET DLL?

Feb 8, 2012

I have a need to create a Tcl extension that calls a managed .NET DLL/Class Library. Currently, the structure of my application is Tcl > DLL Wrapper (C++ CLR) > .NET Class Library (VB.NET), where ">" represents a function call.

My VB.NET DLL just takes a value and returns it back, keeping it simple for now. In the end, this will do some more advanced stuff that makes use of some .NET functionality.

Public Class TestClass
Public Function TestFunction(ByVal param As Integer) As Integer
Return param
End Function
End Class

My Tcl Extension (C++ CLR) creates an object of the type above

int TestCmd(ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
{
// Check the number of arguments

[code].....

If my VB.NET DLL is in the same directory as my extension DLL, the extension crashes when it instantiates a TestClass object. I've noticed if the VB.NET DLL is relocated to C:Tclin, the extension will find it, and TestCmd can be called just fine. The problem is that this will eventually need to be deployed across a number of PCs, and it's preferred not to mingle my application's files with another application's.

View 2 Replies

Call An Extension From C#?

Apr 26, 2010

I have an extension method written in visual basic as follows:

Imports System.Runtime.CompilerServices
Namespace Parsing
...
Public Module CSVParse

[code]....

Unfortunately the compiler is giving a 'Cannot resolve symbol' error for 'DoVB()' and highlighting it red.Yet it will recognise the call in a static fashion.

CSVParse.DoVB(test);

View 1 Replies

Extension Of Customize Set Up?

Sep 8, 2011

I want more customization then the original VS 2010 set up files. So i decided to code everything. For example, i put all my files in my debug folder into my installer.vb's My.Resources. So i usedSystem.IO.File.WriteAllText ---> to install all my files and the .exe one.Everything was installed it except my Ethup Bolt New Build.exe. It shows up in the folder after installation, but when i click on it, it didnt run at all. (It showed up in the task manger, under process, but it disappeared after like 5secs.) So it didnt
run at all. My question is how do i install my .exe properly. ( I DONT WANT TO USE THE ORIGINAL INSTALLER WITH Visual Studio)

View 1 Replies

Get FileSize + Extension With Dot?

Oct 31, 2009

How would i get the size of the file and the Extension with a .(Dot) if it has little tiny bytes or etc and put it into a listview in columns.

EX: MyTextFile(Under File Name) | 23.12 KB (Under Size)

View 12 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved