小编Net*_*nfo的帖子

C++字符串声明

我一直在用VB工作一段时间.现在我给C++一个镜头,我遇到了字符串,我似乎找不到声明字符串的方法.

例如在VB中:

Dim Something As String = "Some text"
Run Code Online (Sandbox Code Playgroud)

要么

Dim Something As String = ListBox1.SelectedItem
Run Code Online (Sandbox Code Playgroud)

什么相当于C++中的上述代码?

任何帮助表示赞赏.

c++ string

12
推荐指数
1
解决办法
16万
查看次数

VB.NET如何在treeview中将子节点添加到特定节点

如何在treeview中将子节点添加到特定节点?假设我已经在树视图中有"Item1",如何将"SubItem1"添加到"Item1"作为其子节点?

我知道它可能非常简单,但我尝试了很多东西,我只是不能让它工作.

vb.net treeview vb.net-2010

5
推荐指数
1
解决办法
8万
查看次数

使用CodeDom编写VB.NET Windows窗体应用程序

如何通过CodeDom编写VB.NET Windows窗体应用程序?

我已经尝试了所有的东西,我得到的最接近的是下面的代码,首先显示命令提示窗口不好,然后显示表格等一秒钟,一切都消失了.还有另一种正确的方法吗?非常感谢一个例子.

Public Module MyApp
    Public Sub main()
        Dim NewForm As New System.Windows.Forms.Form
        NewForm.Name = "Form1"
        NewForm.Text = "Form1"
        NewForm.Width = 300
        NewForm.Height = 300
        NewForm.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
        NewForm.ControlBox = True
        NewForm.MaximizeBox = False
        NewForm.MinimizeBox = True
        NewForm.Show()
    End Sub
End Module
Run Code Online (Sandbox Code Playgroud)

.net vb.net codedom winforms

2
推荐指数
1
解决办法
5305
查看次数

C++类实例化和调用方法

好吧,我只是想试试C++(我现在做C#),现在我的第一个问题是类实例化或在另一个类中调用方法.

这是我的代码:我的主要程序条目:

#include <iostream>
#include "myClass.h"
using namespace std;
    int main()
    {
        myClass* mc = new myClass();
    }
Run Code Online (Sandbox Code Playgroud)

我正在尝试访问的类:

#include "myClass.h"
myClass::myClass()
{
    void DoSomething();
    {

    }
}
myClass::~myClass()
{
}
Run Code Online (Sandbox Code Playgroud)

班级标题:

#pragma once
class myClass
{
public:
    myClass();
    ~myClass();
};
Run Code Online (Sandbox Code Playgroud)

现在你可以看到我已经实例化了这个类,但我无法访问DoSomething()方法.

c++ methods instantiation

0
推荐指数
1
解决办法
607
查看次数

C#设置get,为什么值没设置?

为什么这段代码没有设置值?我在这做错了什么?

public string databaseFolder
{
    set
    {
        XmlDocument xmldoc = new XmlDocument();
        xmldoc.Load(configPath);
        XmlNode node = xmldoc.SelectSingleNode("//Settings/DatabaseFolder");
        node.InnerText = databaseFolder;
        xmldoc.Save(configPath);
    }
    get
    {
        XmlDocument xmldoc = new XmlDocument();
        xmldoc.Load(configPath);
        XmlNode node = xmldoc.SelectSingleNode("//Settings/DatabaseFolder");
        return node.InnerText;
    } 
}
Run Code Online (Sandbox Code Playgroud)

c# get set

0
推荐指数
1
解决办法
75
查看次数

获取当前的类实例

你有没有获得班级的当前实例?

该类有搜索方法和取消方法.

代码示例:

if (btnSearch.Text =="Search")
{
    Searcher srch = new Searcher();
    srch.Search();
    btnSearch.Text = "Cancel";
    return;
}
if (btnSearch.Text == "Cancel")
{
    //call a method in the instance above for example
   srch.Cancel();
}
Run Code Online (Sandbox Code Playgroud)

我想只在btnSearch.Text =="搜索"时创建实例; 当btnSearch.Text =="取消"时; 我想打电话给srch.Cancel();

////感谢nmclean,问题解决了,我觉得必须在更高的范围内声明Search类才能访问当前运行的实例.

c# class instance

-1
推荐指数
1
解决办法
1747
查看次数

标签 统计

c# ×2

c++ ×2

vb.net ×2

.net ×1

class ×1

codedom ×1

get ×1

instance ×1

instantiation ×1

methods ×1

set ×1

string ×1

treeview ×1

vb.net-2010 ×1

winforms ×1